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? Link to comment https://forums.phpfreaks.com/topic/20778-posting-a-dynamic-text-field-resolved/ 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! :) Link to comment https://forums.phpfreaks.com/topic/20778-posting-a-dynamic-text-field-resolved/#findComment-92067 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. Link to comment https://forums.phpfreaks.com/topic/20778-posting-a-dynamic-text-field-resolved/#findComment-92147 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. Link to comment https://forums.phpfreaks.com/topic/20778-posting-a-dynamic-text-field-resolved/#findComment-94646 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.