Help!!!

Ok I have been on this problem all day. Searching and Searching and just when I thought I
had it...the script didn't work as it was supposed to.

My URL looks like this:

http://mysite.com/joinform.php?Email=mymail@gmail.com&Username=newuser&Password=12345678

I need to parse the email, username and password from the url into the form fields on the
page. So far I have only been able to parse the whole URL :(

Thanks in advance for your help.

Recommended Answers

All 4 Replies

$_REQUEST is a combination of the $_GET and $_POST arrays
S_POST is the array of a form submission
$_GET is the array of this type of parameter

http://mysite.com/joinform.php?Email=mymail@gmail.com&Username=newuser&Password=12345678

for single use (php is simple)

echo $_GET['Email'];
echo $_GET['Username'];
echo $_GET['Password'];

for multiple use

$Email = $_GET['Email'];
$Username = $_GET['Username'];
$password = $_GET['Password'];
/* all kinds of code to do whatever with these variables */
var url = String(window.location);
var index = url.indexOf("?");
var data = url.substr(index+1);
var splitted = data.split("=");
var Email = splitted[0].substring(0,splitted[0].indexOf('&'));
var Username = splitted[1].substring(0,splitted[1].indexOf('&'));
var Password = splitted[2];

Javascript is difficult for me, confirm this code works,
but the premise is there to work on

It is not very secure to get a password, the password is visible in the addressbar
such is usually Post-ed

Ok I understand the issue of having the password in the URL so how can I pass the password to the form field?

document.write("<input " + password + ">");

Ok I understand the issue of having the password in the URL so how can I pass the password to the form field?

You should never send a password back from server to client and you should never need to.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.