[RESOLVED] How to get HTML form post values after email validation
I'm trying to write form values to a CSV file AFTER I have validated an email address using a crude form of Double Opt in;
I'm using a modified version of code shown here:
Everything works except I can't capture the form values except the email address.
There's a section where it says
// add the email to your double opt-in list here
After that, I've tried to get the values to post to the CSV file, but I only get the email value. The other form fields dont get posted.
I've tried POST & REQUEST to get the posted variables.
Neither one seems to work.
If I create a separate php file at the end, everything gets posted correctly, but I only want to post the emails that have been validated.
Any ideas welcome.
Why dont you try out with empty field validation in HTML.
You are missing the required <form> element. Here is how your code should be like:
if(document.forms['frm'].question.value == "")
Question: <input name="question"/> <br />
<input id="insert" onclick="return IsEmpty();" type="submit" value="Add Question"/>
Hope this helps you.
Not sure I understood exactly what you meant. I am posting the values from the first page. I send the email of to be confirmed by the sender to make sure that they are the one who is requesting to be signed up. What I want is that AFTER they have responded, I want to add their info to a CSV file, but only AFTER they have responded.
Maybe you just need to make sure that the email address along with all the other form fields are within the same <form> tag?
How to get HTML form post values after email validation
My form tag has name , phonenumber etc.. all in the same form
I even tried to put the variables in sessions & that didn't work
<input type="text" name="name" size="32">
<input type="text" maxlength="8" name="phonenumber" size="21">
$_SESSION['phonenumber'] = $_POST['phonenumber'];
I can't see why I dont have access to the sessions to be able to post them to the CSV file.
TO post I've tried
I've modified it like
$phonenumber = $_SESSION['phonenumber'];
$savestring = $name . "," . $areacode . "," . $phonenumber. "," .$email . "," . $date ."\n";
$phonenumber = $_POST['phonenumber'];
Still Not working
I've NEVER has SESSIONS NOT work after trying all these angles!
Okay, time-out: are we talking about finishing up the process in a separate script request from an email link?
If so, what I would do is store all the info submitted originally in the DB, but flagged as unconfirmed. Then the email link would include a unique identifier for that record, which would be used by the target script to mark that record as confirmed.
An alternative would be to add the additional fields to the email's link as URL query string name/value pairs that would then be in $_GEt.
RE: are we talking about finishing up the process in a separate script request from an email link?
Yes! & I was afraid you would say something like that.
If I was using MySql, understandable, but with CSV files,That's my problem here.
How do I append $name & $phonenumber to this validation script that is sent out. My efforts are probably clouded by my Brain fog.
$mail_body = "To validate this email click the following link:\nhttp://www.mysitedomain.net/Scripts/Client-links.php?e_addy=$from&m=$hashed";
Originally Posted by simora
If you are trying to any type of help regards the HTML coding then there is no need to worry because i am going to suggest you a portal as www.w3schools.com/
l from where you can get help as well as coding according to your need.
I would just add some url-encoding:
(if $hashed is something like an MD5 string, it probably won't really need to be urlencoded, but it doesn't hurt, so might as well be safe.)
$mail_body = "To validate this email click the following link:\nhttp://www.mysitedomain.net/Scripts/Client-links.php?e_addy=".urlencode($from)."&m=".urlencode($hashed);
Thanks again NogDog:
url-encoding did the trick. Also,rather than using SESSIONS, You can specifically request the values again to write to a CSV file as in
$name = $_REQUEST['name'];
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)