jjmusicpro Posted September 27, 2007 Share Posted September 27, 2007 I wanted to send data to a page, then put the value from the database like firstname, lastname, zipcode, into text box's so they can be edited. Then the customer can hit "update" and it will update the zipcode" how would i do that? thanks again everyone! im a newbie at php! Quote Link to comment https://forums.phpfreaks.com/topic/70952-post-to-a-page-and-get-data-in-text-boxs-then-hitting-submit-and-updating-data/ Share on other sites More sharing options...
pocobueno1388 Posted September 27, 2007 Share Posted September 27, 2007 Here is an example. <?php if (isset($_POST['update'])){ $first_name = mysql_real_escape_string($_POST['first_name']); $query = "UPDATE users SET first_name='$first_name' WHERE condition"; $result = mysql_query($query)or die(mysql_error()); echo "Update Successful"; } else { $query = "SELECT first_name FROM users WHERE condition"; $result = mysql_query($query)or die(mysql_error()); $row = mysql_fetch_assoc($result); print<<<FORM <form> <input type="submit" name="first_name" value="{$row['first_name']}"> <input type="submit" name="update" value="update"> </form> FORM; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/70952-post-to-a-page-and-get-data-in-text-boxs-then-hitting-submit-and-updating-data/#findComment-356701 Share on other sites More sharing options...
jjmusicpro Posted September 27, 2007 Author Share Posted September 27, 2007 ok this is what i have now: am i posting when i sent a variable like that in the URL? Can i do the whole "pause" and unpause thing in 1 page? instead of redirecting them to 2 dirrerent pages depening on what they pick? mybe like a switch statement? <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>test</title> </head> <body> <?php echo "<h3>$groupid_sent - $account_name </h3>"; ?> <fieldset> <a href="index.php">Home</a> || <a href="viewzips.php?groupid=<?php echo $groupid_sent; ?>">View Active Zips</a> || <a href="pause.php?groupid=<?php echo $groupid_sent; ?>">Pause Account</a> || <a href="testzips.php?groupid=<?php echo $groupid_sent; ?>">Test Zips</a> </fieldset> <p><a href="confirmpause.php?groupid=<?php echo $groupid_sent; ?>">Pause Account </a> || <a href="unpause.php?groupid=<?php echo $groupid_sent; ?>">Unpause Account </a> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/70952-post-to-a-page-and-get-data-in-text-boxs-then-hitting-submit-and-updating-data/#findComment-356705 Share on other sites More sharing options...
jjmusicpro Posted October 1, 2007 Author Share Posted October 1, 2007 anyone? Quote Link to comment https://forums.phpfreaks.com/topic/70952-post-to-a-page-and-get-data-in-text-boxs-then-hitting-submit-and-updating-data/#findComment-359162 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.