Jump to content

[SOLVED] transfering values from one form to another


phpsql1

Recommended Posts

I have two html pages the first one has email, and name input s. the second page should have amoung other things these two info.

 

I want to display this name and email into the apropriate inputs of the second page while it is being loaded

 

I already assigned those values to variables in php file but my concern is mainly how to use them.

 

any ideas.

 

thanks

<input type="text" name="fieldname" value="<?php echo $_POST['fieldname']; ?>" />

 

You may need to stripslashes on the post fields, you can do them all at once like so, but be cautious if you are entering this data into a DB

 

<?php
foreach ($_POST as $key => $val) {
     $_POST[$key] = stripslashes($val);
}
?>

if you want to display the email address somewhere, you would just use the "$_POST" global variable to retrieve that info. you said you changed it into a variable, but i don't know what that variable was, so i'll make one up...

 

   $email = $_POST['s'];

 

if you wanted to display it anywhere on the page, you could say

 

<p>The email you supplied is <?php echo "".$email.""; ?></p>

 

if you didn't need to display it, but just pass it along from the second page of the form to, say, a database insert, you would need to turn it into a hidden input field of the form, thusly:

 

<input type="hidden" name="s" value="<?php echo "".$email.""; ?>" />

 

something like that.

can you guys elaborate a little. to make sure we are in the same frequency this is where am blocked.

 

in the first page:

<input type "text" name "email">

let's the user inputs [email protected]

and hit next

 

The second page is loaded

this page has (amoung other ethings) a field reserved for the e-mail. this field's value should be [email protected].

 

thanks

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.