pikemsu28 Posted September 14, 2006 Share Posted September 14, 2006 Sorry if this is basic, i'm very new to php and mysql. I have a form that will be used to update registration information the user entered when registering for access to my site. I have the information displaying using <?php echo $row_table['value'];?> in the text field. how would i then update the form if the person changes the information and clicks the post button? Quote Link to comment Share on other sites More sharing options...
ultrus Posted September 14, 2006 Share Posted September 14, 2006 Hello,I'm not sure how to answer your question as I am a bit of a newb myself. I think you will need to "update" the info in the database before retreiving and showing the info in the form? Or perhaps do an if statement if you don't want to post it to the database just yet like this:[code]<?phpif($_POST['value']) { echo $_POST['value']; } else { echo $row_table['value']; }?>[/code]For mysql examples, I always find this site to be a good reference:http://www.tizag.com/mysqlTutorial/Hope this helps inspire something! :) Quote Link to comment Share on other sites More sharing options...
JustinK101 Posted September 15, 2006 Share Posted September 15, 2006 By update the form I assume you mean UPDATE in the database? I will explain the generals, though there is more to get it working.1.) Assign a hidden value into the form.<input type="hidden" name="isSubmitted" value="true">This allows you to tell if a user has clicked submit on the form.2.) Check the value of $_GET['isSubmitted'] assuming your form method is GET.if(isset($_GET['isSubmitted'])){ //Preform The MySQL Update $sql = "UPDATE table SET value = '" . $_GET['value'] . "' WHERE someclause LIMIT 1"; mysql_query($sql) || die(mysql_error());}Again there is more to this, but this should get your started. Quote Link to comment Share on other sites More sharing options...
pikemsu28 Posted September 19, 2006 Author Share Posted September 19, 2006 Thanks Justin, I needed the hidden form variable to post the changes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.