Hidden variables

They have: 16 posts

Joined: Mar 2001

I used the code below to store the last name of the user in a hidden variable. However, when I try to retrieve the value of Lname, I get the value: , even if the user did not enter any value in the respective textbox.

What causes this problem? HELP!

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I'm sorry, what's the value? Is it the comma, or the space before the comma?

post code please Wink

They have: 16 posts

Joined: Mar 2001

the value is a comma

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

can you post your code? (anything that handles that variable, and the form)

They have: 16 posts

Joined: Mar 2001

this is the code:

<?php
sNextStep
= "1"
select case request.form("current")
case
"1": sNextStep = "2"
case "2": sNextStep = "3"
case "3": sNextStep = "4"
case "4": sNextStep = "5"
case "5": sNextStep = "6"
case "6": sNextStep = "7"
case "7": sNextStep = "8"
case "8": sNextStep = "9"
case "9": sNextStep = "10"
case "10": 'do nothing
case default: sNextStep = "1"
end select
Response.write("<INPUT TYPE=""hidden"" NAME=""LName"" VALUE=""" & LName & """>")
Response.write("<INPUT TYPE=""hidden"" NAME=""FName"" VALUE=""" & FName & """>")
Response.write("<INPUT TYPE=""hidden"" NAME=""MName"" VALUE=""" & MName & """>")
Response.write("<INPUT TYPE=""hidden"" NAME=""NName"" VALUE=""" & NName & """>")
Response.write("<INPUT TYPE=""hidden"" NAME=""current"" VALUE=""" & sNextStep & """>")
select case sNextStep 
<table align=center width="90%">
  <tr bordercolor=white bgcolor="#0000cc"><td colspan="4"><center><big>Application for Employment</big></center></td></tr>
<tr bordercolor="white"><td>Name <small>(Last/First/Middle)</small><br><input type="text" name="LName" maxlength="50" size="18"></td>
  <td width="15%"><br><input type="text" name="FName" maxlength="50" size="20"></td>
  <td width="15%"><br><input type="text" name="MName" maxlength="50" size="20"></td>
  <td width="15%">Nickname<br><input type="text" name="NName" maxlength="20" size="15"></td></tr>
<tr bordercolor=white><td colspan="2">Current Address<br><input type="text" name="CurAdd" maxlength="100" size="40"></td>
  <td width="15%">Residence Tel. No.<br><input type="text" name="ResTelNo" maxlength="15" size="15"></td>
  <td width="15%">SSS No.<br><input type="text" name="SSSNo" maxlength="20" size="15"></td></tr></table><p align=center><input type="button" name="Button1" value="Next" onclick="validateForm1()"></p>
<%case "2": '
Step 2 
?>

Application for Employment

<?php
case "3": ' Step 3
?>

Application for Employment

<?php
case "4": 'Step 4
?>

Application for Employment

<?php
case "5": ' Step 5
?>

Application for Employment

<?php
case "6": 'Step 6
?>

Application for Employment

<?php
case "7": ' Step 7
?>

Application for Employment

<?php
case "8" ' Step 8
?>
Please recheck all entered values
Information to be Sent
Last Name
<?php
=LName
?>

First Name
<?php
=FName
?>

Middle Name
<?php
=MName
?>

Nick Name
<?php
=NName
?>

<?php
case "9" 'Step 9
call SendApplication
?>
Your application form has been sent.

<?php
case "10" 'Step 10
response.redirect("/IndexInfo.asp")
end select
?>

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Just a guess. But it may be doing that because you have two form elements with the same name on page one (one hidden the other a textbox). Try printing the hidden fields on every page BUT page one.

Does it break right after submitting page one? Or further down the line?

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.