Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form not populating variable

Status
Not open for further replies.

Steel811

Programmer
Jan 2, 2008
26
US
Hello,

I have a simple web form that is populating a login variable with a value of "SEND". However, in my current version of PHP, 5.2.5, it is not populating, but in the older version which the application was built upon, it is. Does anyone know what could be causing something like that. Below is the code for the HTML web form:

echo "<FORM NAME=TestFrm METHOD=post ACTION=\"$PHP_SELF?".SID. "\">";
echo "<Table>
<tr>
<td align=left>User Name:</td>
<td align=left><INPUT TYPE=text NAME=userId></td>
</tr>
<tr>
<td align=left>Password:</td>
<td align=left><INPUT TYPE=PASSWORD NAME=password></td>
</tr>
<tr>
<td align=center><INPUT TYPE=SUBMIT NAME=login VALUE='SEND'></td>
<td align=center><INPUT TYPE=RESET VALUE='CANCEL'></td>
</tr>
</Table></FORM>";
 
How are you referencing your variable?

If the form is posted the variable $_POST['login'] should have the value "SEND".

Can we see your PHP code?




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Hi,

Here is the way the $login is being referenced:

if ($login=='SEND')
{ //check password and user id
//if password ok start session and run crs select form
//else out put error and run login form again
$userId=HTMLSpecialChars($userId);
$password=HTMLSpecialChars($password);
if(strlen($userId)>15 || strlen($password)>10)
{
echo "<font color=red size=18> Illegal user and password!</font>";
$login="";
}
else
{
session_start();
$tempUser=new User($password, $userId);
if( $tempUser->user_connect())
{
session_register("ipAddr", "tempUser");
$ipAddr=Gethostbyname("keithweitz");
}
else
{
$errStr="<font color=red><B>Could not connect to database.</font>";
$login="";
}
}
}

Unfortunately it's not throwing any errors to the screen or anything just taking me back to the login screen.
 
Are you expecting $login to be directly created from the form?
It assumes the register_globals directive is set to ON.

Which hasn't been the case since PHP 4.2.

And the directive will no longer be available for switching starting in version 6.0.

Its a big security risk to rely on anyway.

try:

Code:
$login=$_POST['login'];

Right before the: if($login=="SEND")






----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
That looks like it worked! Thanks Phil. the site still isn't working, but I'm at least moving along!

Thanks again!
Sheel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top