Home » questions » Passing varibles to text boxes in different browsers?

Passing varibles to text boxes in different browsers?

2006-08-07 12:54:54, Category: Programming & Design
Scenario: -Open a new webpage in a new browser in your PHP code. -The new webpage has a username and password field How do you pass the username and password you have stored in $variables in your PHP code to the username and password textbox on the new webpage? Thanks

Answers

  1. John J

    On 2006-08-07 13:14:36


    I recommend not ever auto-populating the password. This will make hacking the user's computer very easy. To do what you are asking you can do it one of two ways - 1) store the variables server side in a database, etc. and then do option two or: 2) pass the variables directly using either cookies or get values - the redirect is handled simply by: header("Location: newUrl.php"); to add get values just add ?variable=value... after .php in the above code. to set a cookie just run setcookie( 'var', 'val'); you would then, on the next page, just need to parse those variables out from where you saved them and set the value attribute of your text boxes like so: