Jump to content

post to a page and get data in text box's, then hitting submit and updating data


Recommended Posts

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!

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;

}

?>

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.