I have a edit form where I would like to be able to allow users to edit some or all of the fields of a database record.
Code from my form page:
Code from the processing script (change_details4.php):Code:$RaceInfo = mysql_query("SELECT Race_ID, Race_Name, Race_Date FROM Races WHERE Race_ID='".$searchrace."'",$db); while ($record6 = mysql_fetch_array($RaceInfo)) { $raceidz = $record6["Race_ID"]; $racename = $record6["Race_Name"]; $racedate = $record6["Race_Date"]; } echo "<form action='change_details4.php' method='post'>"; echo "<table>"; echo "<tr><td>"; echo "<font size=4><b><center>Race ID: <input type='text' name='ud_raceid' size='3' value=$raceidz>"; echo "</td><td>"; echo "<font size=4><b><center>Race Name: <input type='text' name='ud_racename' size='30' value='".$racename."'>"; echo "</td><td>"; echo "<font size=4><b><center>Race Date: <input type='text' name='ud_racedate' size='10' value=$racedate>"; echo "</td></tr>"; echo "</table>"; echo "<input type='Submit' value='Update'></form>";
But this is not working.... I'm pretty sure it must have something to do with the WHERE clause of the UPDATE command line, am I right? I somehow need to, for example, say 'change Race ID to AUS WHERE it currently equals AUT' or something similar...Code:$ud_raceid=$_POST['ud_raceid']; $ud_racename=$_POST['ud_racename']; $ud_racedate=$_POST['ud_racedate']; mysql_query("UPDATE Races SET Race_ID = '".$ud_raceid."', Race_Name = '".$ud_racename."', Race_Date = '".$ud_racedate."' WHERE Race_ID='".$ud_raceid."'",$db); echo "Records Updated";
Can you help?
kemi
P.S. I deliberately left off database connections codes etc, and tried to just stick to providing the code that is relevant to my question. If you need more, just ask![]()





Bookmarks