Advertisement
Hey all~
I've been working on a site over the past week that got me to set up a form processor, and add a hidden variable that would let the processor know which page the form was from (there's about 10 on the site!) So I set up a hidden field and an extra one as kind of a debugging tool and used POST to submit the form.
<form id="form1" name="form1" method="post" action="processform.php">
<input name="whichform" type="hidden" value="nlp" />
<input name="debug" type="hidden" value="nlp_page" />
In the processor file, the first section was to set local variables to the POST submissions:
$currentdate = date("H:i, jS F");
$name = $_POST['firstname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$comment = $_POST['comment'];
$formid = $_POST['whichform'];
$debug=$POST_['debug'];
Which should have been really simple. The problem was that when I echoed the variables to the screen, whichform and debug weren't being passed to the php file. After trying a bunch of different things, I deleted the other variables and had just the $formid statement and suddenly it worked! So I added the others after it and ended up with this :
$formid = $_POST['whichform'];
$debug=$_POST['debug'];
$currentdate = date("H:i, jS F");
$name = $_POST['firstname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$comment = $_POST['comment'];
And I finally got whichform to show up, so I could use it to set the subject line of an email. The odd thing is that debug still never made it over and I can't figure out why. I was under the impression that with POST, the variables were all just dumped into it and the order you accessed them didn't matter, but the 1 1/2 hours of my Saturday morning working on this proved otherwise.
Is this something anyone else has encountered?
SMS
I've been working on a site over the past week that got me to set up a form processor, and add a hidden variable that would let the processor know which page the form was from (there's about 10 on the site!) So I set up a hidden field and an extra one as kind of a debugging tool and used POST to submit the form.
<form id="form1" name="form1" method="post" action="processform.php">
<input name="whichform" type="hidden" value="nlp" />
<input name="debug" type="hidden" value="nlp_page" />
In the processor file, the first section was to set local variables to the POST submissions:
$currentdate = date("H:i, jS F");
$name = $_POST['firstname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$comment = $_POST['comment'];
$formid = $_POST['whichform'];
$debug=$POST_['debug'];
Which should have been really simple. The problem was that when I echoed the variables to the screen, whichform and debug weren't being passed to the php file. After trying a bunch of different things, I deleted the other variables and had just the $formid statement and suddenly it worked! So I added the others after it and ended up with this :
$formid = $_POST['whichform'];
$debug=$_POST['debug'];
$currentdate = date("H:i, jS F");
$name = $_POST['firstname'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$comment = $_POST['comment'];
And I finally got whichform to show up, so I could use it to set the subject line of an email. The odd thing is that debug still never made it over and I can't figure out why. I was under the impression that with POST, the variables were all just dumped into it and the order you accessed them didn't matter, but the 1 1/2 hours of my Saturday morning working on this proved otherwise.
Is this something anyone else has encountered?
SMS
Advertisement
Advertisement