Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send Form Input to Confirm Page

Status
Not open for further replies.

about2flip

Technical User
Nov 21, 2003
31
US
Hi:

I'm learning PHP and I am going to develop a form to take user input, but I am confused how to submit the information in Form1 to the confirmation page Form2, so the user can look over what they input before it writes to the DB.

If there is a post on how to do this please provide link, or code will be helpful.

Thanks in advance.
 
On the second page be sure to include the variables posted from the form. For instance:

The Form -
Code:
<html><head></head>
<body>
<form action="send.php" method="post">
<input type="text" name="first_name"><br>
<input type="text" name="last_name"><br>
<input type="text" name="email"><br>
<input type="submit" name="send_form" value="File it">
</form>
</body>
</html>

The Form Display Page:
Code:
<?
if(!empty($_POST['send_form'])){
echo "Please confirm what was entered into the form:<br><br>First Name: ".$_POST['first_name']."<br>Last Name: ".$_POST['last_name']."<br>Email Address: ".$_POST['email']."<br>";
?>
<html>
<head></head>
<body>
<form action="final_submit.php" method="post">
<input type="hidden" name="first_name" value="<? $_POST['first_name']; ?>">
<input type="hidden" name="last_name" value="<? $_POST['last_name']; ?>">
<input type="hidden" name="email" value="<? $_POST['email']; ?>">
<input type="submit" name="verify_submit" value="Verify">
</form>
</body>
</html>

and you just have to take the final input and use it along with a SQL statement and then you have the option of thanking the user or forwarding them to the home page, etc...


Hope this helps!

Web site design, internet marketing, SEO and business solutions company.
 
In the last message, I forgot to close the php if statement with a curly bracket like so:
Code:
<?
if(!empty($_POST['send_form'])){
echo "Please confirm what was entered into the form:<br><br>First Name: ".$_POST['first_name']."<br>Last Name: ".$_POST['last_name']."<br>Email Address: ".$_POST['email']."<br>";
}
?>
<html>
<head></head>
<body>
<form action="final_submit.php" method="post">
<input type="hidden" name="first_name" value="<? $_POST['first_name']; ?>">
<input type="hidden" name="last_name" value="<? $_POST['last_name']; ?>">
<input type="hidden" name="email" value="<? $_POST['email']; ?>">
<input type="submit" name="verify_submit" value="Verify">
</form>
</body>
</html>

Web site design, internet marketing, SEO and business solutions company.
 
Thanks so much! So my script to write to the DB, email the form and thank the user will be in "final_submit.php". Correct?

 
I'm getting an error in my verify.php page. The error is displaying on the screen.

echo "First Name:".$_POST['first_name'] echo "Last Name:".$_POST['last_name'] echo "Street Address:".$_POST['street_address'] echo "City:".$_POST['city'] echo "State:".$_POST['state'] echo "Zip Code:".$_POST['zipcode'] echo "Phone Number:".$_POST['phone_number] echo "User Name:".$_POST['username'] echo "Email:".$_POST['email'] php> }

This is my code:

<php
if(!empty($_POST['send_form'])){
echo "Please verify your information that you entered:"<br><br>
echo "First Name:".$_POST['first_name']
echo "Last Name:".$_POST['last_name']
echo "Street Address:".$_POST['street_address']
echo "City:".$_POST['city']
echo "State:".$_POST['state']
echo "Zip Code:".$_POST['zipcode']
echo "Phone Number:".$_POST['phone_number]
echo "User Name:".$_POST['username']
echo "Email:".$_POST['email']
}
php>
<html>
<head></head>
<body>
<form action="thankyou.php" method="post">
<input type="hidden" name="first_name" value="<? $_POST['first_name']; ?>">
<input type="hidden" name="last_name" value="<? $_POST['first_name']; ?>">
<input type="hidden" name="street_address" value="<? $_POST['street-address']; ?>">
<input type="hidden" name="city" value="<? $_POST['city']; ?>">
<input type="hidden" name="state" value="<? $_POST['state']; ?>">
<input type="hidden" name="zipcode" value="<? $_POST['zipcode']; ?>">
<input type="hidden" name="phone_number" value="<? $_POST['phone_number']; ?>">
<input type="hidden" name="username" value="<? $_POST['username']; ?>">
<input type="hidden" name="email" value="<? $_POST['email']; ?>">
<input type="submit" value="Submit">
</form>
</body>
</html>

Thanks In Advance
 
The opening and closing tags for PHP have a "?" in them:

<?php
.. code..
?>

 
Thanks. Now getting a parse error on Line 3. I put semi-colons on each line that is in the PHP statement.

Hate to be a bother. Thanks again for the help
 
I'm pulling my hair. I figured out my error on line 3, but can not figure out why I am getting a parse error on line 11. I am using Zend Development, and red underlines are under Lines 11-22. The Code again:

<?php
if(!empty($_POST['send_form'])) {
echo "Please verify your information that you entered:<br><br>";
echo "First Name:".$_POST['first_name'];
echo "Last Name:".$_POST['last_name'];
echo "Street Address:".$_POST['street_address'];
echo "City:".$_POST['city'];
echo "State:".$_POST['state'];
echo "Zip Code:".$_POST['zipcode'];
echo "Phone Number:".$_POST['phone_number];
echo "User Name:".$_POST['username'];
echo "Email:".$_POST['email'];
}
?>
<html>
<head></head>
<body>
<form action="thankyou.php" method="post">
<input type="hidden" name="first_name" value="<? $_POST['first_name']; ?>">
<input type="hidden" name="last_name" value="<? $_POST['last_name']; ?>">
<input type="hidden" name="street_address" value="<? $_POST['street-address']; ?>">
<input type="hidden" name="city" value="<? $_POST['city']; ?>">
<input type="hidden" name="state" value="<? $_POST['state']; ?>">
<input type="hidden" name="zipcode" value="<? $_POST['zipcode']; ?>">
<input type="hidden" name="phone_number" value="<? $_POST['phone_number']; ?>">
<input type="hidden" name="username" value="<? $_POST['username']; ?>">
<input type="hidden" name="email" value="<? $_POST['email']; ?>">
<input type="submit" value="Submit">
</form>
</body>
</html>

Thanks to those who helped.
 
In this line:
Code:
echo "Phone Number:".$_POST['phone_number];
You are missing the second single quote after phone_number
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top