Connects like:
Code: Select all
$result = mysql_query("SELECT * FROM survey
WHERE Uname='{$_SESSION['Uname']}'") or die(mysql_error());
$row = mysql_fetch_array( $result );Code: Select all
echo "<table><form method=post action=survey.php?action=update>";
echo "<tr><td><font size=2>Name:</td><td><input type=text name=name value=" . $row['name'] . "></td></tr>";
echo "<tr><td><font size=2>Birthday:</td><td><input type=text name=birthday value=" . $row['birthday'] . "></td></tr>";
echo "<tr><td><font size=2>Birthplace:</td><td><input type=text name=birthplace value=" . $row['birthplace'] . "></td></tr>";Code: Select all
$result = mysql_query("UPDATE survey SET name='{$_POST['name']}' WHERE Uname='{$_SESSION['Uname']}'")
or die(mysql_error());
$result = mysql_query("UPDATE survey SET birthday='{$_POST['birthday']}' WHERE Uname='{$_SESSION['Uname']}'")
or die(mysql_error());
$result = mysql_query("UPDATE survey SET birthplace='{$_POST['birthplace']}' WHERE Uname='{$_SESSION['Uname']}'")
or die(mysql_error());Why is it cutting off the values when displaying them in the form again, thus requireing the user to change all of their entries again if they want to update stuff, or they would lose all their entries that contain stuff after a space or comma.
Thanks in advance.