Daney11 Posted March 17, 2007 Share Posted March 17, 2007 Hi guys. Im stuck on something probably very simple. My question is, I have created a form, with values within a script and a submit button. I want to use the form on the same script... For example update_value.php <form method="post" action="update_value.php"> <table width="654" cellpadding="0" cellspacing="0" align="center" class="outline"> <tr> <td width="168" height="20" align="left" valign="middle"><?php echo " $name "; ?> <td width="168" height="20" align="left" valign="middle"><input class="shoutbox" name="value" type="text" value="<?php echo "$value" ?>" /></td> <td width="318" height="20" align="left" valign="middle"> <select name="123" class="shoutbox"> <option value=1 selected>Goodbye</option> <option value=2>Hello</option> </select></td> </td> </tr> </table> <table width="654" cellpadding="0" cellspacing="0" align="center"> <tr> <td height="1"><img src="images/1pspacer.gif"></td> </tr> </table> <table width="654" cellpadding="0" cellspacing="0" align="center" class="outline"> <tr> <td height="20" colspan="10" align="center" valign="middle"><input name="give" type="submit" class="shoutbox" value="Submit"></td> </tr> </table> <table width="654" cellpadding="0" cellspacing="0" align="center"> <tr> <td height="1">images/1pspacer.gif"></td> </tr> </table> </form> Now, if i was to click on submit and run this script, how would i go about updating tables in my database with the $value attribute..? Thanks Dane Link to comment https://forums.phpfreaks.com/topic/43179-form-processing/ Share on other sites More sharing options...
suzzane2020 Posted March 18, 2007 Share Posted March 18, 2007 Iam nt sure if i gt the prob rite.. the action of the form is set to the same page so all that is required is get the values through post method and update it in the database.. if(isset($_POST["give"])) { $value=$_POST["value"]; } Link to comment https://forums.phpfreaks.com/topic/43179-form-processing/#findComment-209665 Share on other sites More sharing options...
Daney11 Posted March 18, 2007 Author Share Posted March 18, 2007 Its not updating for some reason :S all values are correct and the sql query is correct too... Where do i put this? at the start of my script or at the end? Link to comment https://forums.phpfreaks.com/topic/43179-form-processing/#findComment-209674 Share on other sites More sharing options...
suzzane2020 Posted March 18, 2007 Share Posted March 18, 2007 At the start of the script i wud say Link to comment https://forums.phpfreaks.com/topic/43179-form-processing/#findComment-209676 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.