Jump to content

Feild Forwarder


Recommended Posts

I've been looking around for a while on how to get data from a form to be used in more than one page. Now, I found this website that gave this php feature called feild_forwarder that forwards all data submitted in a form to another form. Does this only work if the first form is posted to the next form or could it still work if it was redireced to it or something. Here where I got all this information:[url=http://www.tutorialized.com/tutorial/Multi-page-Forms-with-PHP/735]http://www.tutorialized.com/tutorial/Multi-page-Forms-with-PHP/735[/url] and at the bottom if you click back there is another page. Check this out if you can and tell me what this is all about if you can because I don't get it.
Link to comment
Share on other sites

Hi jwk811,

This method will work, but it has disadvantages. What happens if the user accidently closes or refreshes their browser? Oops!

I don't know whether this is what you want, but you could use [color=blue][b]mySQL[/b][/color] to solve your problem. It's a little complicated, but you could do the following:

1. Create the page containing the form. [b]eg: [color=red]login.html[/color][/b]
2. Set the action of the form to your submit page [b]eg: [color=red]/includes/login.php[/color][/b]
3. On the [b]login.php[/b] page, make a simple refresh, such as:
header("Refresh: 2; url=http://www.your-site.com/next_form.php");
This page ([b]login.php[/b]) will enter the data into your [color=blue][b]mySQL[/b][/color] database and redirect the user to the next form automatically after 2 seconds.
4. Create your next form, retrieving the info just entered from the db and displaying it onto the page.
The user will see the data they just entered.
6. You can then set the action of the form to update or create a new form using the updated data.

This method will be slower than others, but it's pretty bulletproof and has many advantages. Such as; you have the form data in a database, so you can manipulate or use it in any way later on.

Hope this help you!
Link to comment
Share on other sites

Thanks Iceman but complicated must be way to complicated from where I'm at now. That's an option and I think I'm going to try it out because that seems exactly what I need, but how does this work. You said just do the refresh method and then what? How will I get the information in my database and what will come up on the next page? Can I just take any information out from the database. I am VERY new to this and haven't dealt with it before. Someone please help. And black night I have thought of sessions or cookies but they as well as this seem a bit too complicated and I'm trying my best to learn all this. Any help will be great!
Link to comment
Share on other sites

The feild forwarder would only work if the action of the form was to the next form you wanted to attach the information from right? I going to need it either way for a little part and going to need something else like iceman or blacknight was saying before. Say if I take data submitted in a form to the next page and catch it all in that form (which is going to be a verification form) as a hidden feild and once they confirm that I want that information emailed to me, but how to you get hidden feilds to come up in an email?
Link to comment
Share on other sites

Hey jwk811,

Sorry for not replying sooner, been out of action for a few days.
Anyway, to answer you plight, take a look at the following links for an excellent grounding in PHP MySQL:
It will be easier if you could just copy the code for your problem from somewhere, but I assure you, it will be well worth it to learn a little php first. It will certainly pay off later and save you many headaches.

[b]Moving on:[/b]
Anyway, as I was saying, you use a MySQL INSERT query on page 1, which is your form. Using this query, you put the form data into the database when the user submits the form.

You then redirect the user to the second form page (using that 'refresh' code), where you grab the data from the database and echo it back to the page, example:
$con = mysql_connect("dbhost","dbuser","dbpass");
if (!$con)
  die('Could not connect to the database: ' . mysql_error());

$id = $_POST['id'];
mysql_select_db("dbname", $con);
$result = mysql_query("SELECT * FROM dbname WHERE id='$id';");
while($row = mysql_fetch_array( $result ))
<table align="center" width="800"><tr><td>
<form action="Update/Form/Page" method="POST">
<input type="hidden" name="id" value="<?php echo $row['id']; ?>">
<input type="text" name="author" value="<?php echo $row['author']; ?>">
<br />
<input type="text" name="date" value="<?php echo $row['date']; ?>">
<br />
<textarea name="body"><?php echo $row['body']; ?></textarea>
<br /><br />
<table align="center" width="800"><tr><td align="center">
<input type="submit" value="Update Form">

When the user submits this form, it will update the existing info with the new stuff entered by the user.

Obviously, it needs some adjusting, but it's a good example to study.
Don't worry, keep with it & you'll soon figure it out!

Post again if you have problems,
Link to comment
Share on other sites

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.

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.