The information will save into the database. I can refresh and it will remain saved. In my browser, after saving the information, if I click go or click on the url and hit enter, the form clears and the tables clear in mysql. How can I prevent this and what am I doing wrong?
<?php
$about = $_POST["about"];
?>
</head>
<body>
<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
<form><textarea name="about" input type="text" cols="30" rows="10">
<? echo stripslashes($about);
$about=nl2br($about); ?>
</textarea>
<input type="submit" value="Save" name="submit"/>
</form>
<?php
$con = mysql_connect("localhost","username","pa…
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
mysql_query("UPDATE info SET about = '$about'");
mysql_close($con);
?>
</form>
I'm doing the update because there will be default information.
I just started php a cpl of months ago and this is my first hand written project. Any examples would help.
<?php
$about = $_POST["about"];
?>
</head>
<body>
<form method="post" action="<?= $_SERVER['PHP_SELF'] ?>">
<form><textarea name="about" input type="text" cols="30" rows="10">
<? echo stripslashes($about);
$about=nl2br($about); ?>
</textarea>
<input type="submit" value="Save" name="submit"/>
</form>
<?php
$con = mysql_connect("localhost","username","pa…
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("database", $con);
mysql_query("UPDATE info SET about = '$about'");
mysql_close($con);
?>
</form>
I'm doing the update because there will be default information.
I just started php a cpl of months ago and this is my first hand written project. Any examples would help.