English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

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

2006-08-07 08:54:54 · 1 answers · asked by rfulky 1 in Computers & Internet Programming & Design

1 answers

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:

2006-08-07 09:14:36 · answer #1 · answered by John J 6 · 0 0

fedest.com, questions and answers