Ok, its late at night and my brains playing tricks on me. <input type="text" class="form1" id="emailaddress" name="emailaddress"> Is the input for the email address, this is then got within the php with $_POST["emailaddress"] I then want to have this equaled here $sFromEmailName = "$emailaddress"; Whats wrong with that?? Thanks
If you are trying to assign the value of the field emailaddress from the post to the sFromEmailname variable, then you would want this: $sFromEmailName = $_POST['emailaddress']; PHP:
ok, thanks however i have realised that when the first part of the form is submit the fields are blank so nothing is being sent in the second part, so i need to save $_POST['emailaddress'] into a cookie but only if post is full and then have $sFromEmailName = equal the content of that cookie
I don't think that's necessary (cookies). Check your form fields and also validate the input with javascript or php. If you post some code I might be able to help a bit more.
Are you sure that your form method is POST and not GET? What happens if you use $_GET instead? BTW, if you're assigning one variable to another, you don't need quotes around the second variable.
May be this will help. <form action="getform.php" method="post"> <input type="text" class="form1" id="emailaddress" name="emailaddress"> <input type="submit" value="submit"> </form> Then in "getform.php": <?php if(trim($_POST['emailaddress']) == "") { echo "Please enter email"; } else { $sFromEmailName = $_POST['emailaddress']; // then continue with whatever you want to do. } ?> It's not good practice to store email id's in cookies. Secondly, above is just an empty check. You must also see if the email id submitted is valid or not. Hope this helps you.
Well its a form to firstly have the user input there email address and password to get their hotmail contacts. It then displays their email addresses within a tick box to allow them who to send the email to. Then has a send button which sends all of those people an email aobut funzac. The only problem is i can't for the life of me get the header email too be the same one as the one they input. It could be something to do with when they press the second button the stuff input data has been lost?? <form method="post" action=""> <input type="text" class="form1" id="emailaddress" name="emailaddress"> $sFromEmailName = "FunZac.com"; $sFromEmail = "referral@funzac.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= ' <' . $sEmail . '>' . "\r\n"; $headers .= 'From: ' . $sFromEmailName . ' <' . $sFromEmail . '>' . "\r\n"; Code (markup): If i change: $sFromEmailName = "FunZac.com"; $sFromEmail = "referral@funzac.com"; PHP: To the input name of the field where the email adress was put in it doesn't work and displays email sent form unkown.
You are checking $emailaddress not $_POST['emailaddress']. Two different variables. Also when you "check" you use double equal sign "==" instead of only one. Peace,
Ok, sorted thanks for your help, too see it working... http://funzac.com/play/Puzzle Bobble.html the form at the bottom
It's a bit late to help you now but if anyone else is interested I actually have a tutorial covering this exact topic on my blog - Contacting a contact list from MSN and Gmail