mynahbird Posted June 28, 2011 Share Posted June 28, 2011 Aloha ~ I am having problems with my code not submitting all variables. The following is excepts from an html form which also includes name address, etc. The Brochure_Number and most all the other variables appear on the emailed form, but .. 1) Date_Purchased, what code needed to get the date printed on the brochure to appear in the email? I get it with php current date code; but am confused as to what code to receive inputed data: Month, Day, Year. Don't really want to do a pop up calendar because of conflicting codes within the page, like JSs Is their a shorter way? 2) Where ~ Does not go through to the emailed form. I don't know why. Can't find the error, Please Help <form method="post" action="contactengine.php"> <input type="text" name="Brochure_Number" value="" id="Brochure_Number" /> <label for="Where">Where or who did you purchase your Brochure from?:</label> <label for="Date_Purchased">Date_Purchased:</label> <input type="text" name="Date_Purchased" value="" id="Date_Purchased" /> <label for="Where">Where or who did you purchase your Brochure from?:</label> <input type="text" name="Where" value="" id="Where" size="50" /> <input type="submit" name="submit" value="Submit" class="submit-button" /> </form> The following is the complete php code on ...... contactengine.php ~ <?php $EmailFrom = "[email protected]"; $EmailTo = "[email protected]"; $Brochure_Number=($_POST['Brochure_Number']); $Date_Purchased=($_POST['Date_Purchased']); $Name=($_POST['Name']); $Street=($_POST['Street']); $City=($_POST['City']); $Zip=($_POST['Zip']); $Phone=($_POST['Phone']); $Cell=($_POST['Cell']); $Email=($_POST['Email']); $Sq_Ft=($_POST['Sq_Ft]); $to=$EmailTo; $subject="Brochure Registration"; $message="Brochure_Number: $Brochure_Number\nDate_Purchased: $Date_Purchased\nFrom: $Name\nStreet: $Street\nCity: $City\nZip: $Zip\nPhone: $Phone\nCell: $Cell\nEmail: $Email\nSq_Ft: $Sq_Ft\nOwn: $Own\nRent: $Rent\nWhere: $Where\n".$message; @mail($to,$subject,$message,$headers); // redirect to success page if (@mail){ print "<meta http-equiv=\"refresh\" content=\"0;URL=http://sunnycarpet.com/thanks.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\";0;URL=error.htm\">"; } ?> All help is welcome, my brain is crying out for help! Mahalo for your kokua! ~S~ :'( Quote Link to comment https://forums.phpfreaks.com/topic/240663-help-on-email-submission-form/ Share on other sites More sharing options...
EdwinPaul Posted June 28, 2011 Share Posted June 28, 2011 First: you are missing a single quote: $Sq_Ft=($_POST['Sq_Ft]); Second: do NOT use @ in front of a command. It suppresses the error. Third: where is your $Where -variable defined? Quote Link to comment https://forums.phpfreaks.com/topic/240663-help-on-email-submission-form/#findComment-1236082 Share on other sites More sharing options...
gizmola Posted June 28, 2011 Share Posted June 28, 2011 All the post variables come in through the $_POST. You neglected to assign your $Where variable to anything, so that is why it is empty. As for date, you need the date to be in a format where it can be parsed reliably unless you want to just accept any old thing. If you don't want to do it through javascript you'll inevitably get problems. Probably the best solution in that case is to break it into 3 seperate form elements for Year/month/day, pass those and assemble them into a string later. Of course you'll still risk invalid dates via typos or people misfilling the form, and even javascript is not a panacea, but it will greatly improve the results for your legitimate users. Quote Link to comment https://forums.phpfreaks.com/topic/240663-help-on-email-submission-form/#findComment-1236084 Share on other sites More sharing options...
YoungNate_Black_coder Posted June 28, 2011 Share Posted June 28, 2011 u should do a date picker for date purchased for the rest of that code it looks alright to me what version of php is your server because with new sytanx i dnt think @email is compatable i would just right it into isset varible: $mail = email(......); if(isset($mail)){ header('location: where.php?mailed=set'); } something like that is what i have runing on my site now.. Quote Link to comment https://forums.phpfreaks.com/topic/240663-help-on-email-submission-form/#findComment-1236085 Share on other sites More sharing options...
gizmola Posted June 28, 2011 Share Posted June 28, 2011 First: you are missing a single quote: $Sq_Ft=($_POST['Sq_Ft]); Second: do NOT use @ in front of a command. It suppresses the error. Third: where is your $Where -variable defined? Nice pickup by EdwinPaul That error would not allow it to parse, so I'm not sure what that says about the state of your current script. Quote Link to comment https://forums.phpfreaks.com/topic/240663-help-on-email-submission-form/#findComment-1236086 Share on other sites More sharing options...
mynahbird Posted June 28, 2011 Author Share Posted June 28, 2011 Oh my goodness ~ Thankyou for all your quick replies! My third form this week so my eyes just cannot see small things like apostrophe missing. Thanks for the second, third, fourth sets of eyes on this. Off to fix my where and get it together with a date picker Mahalo Nui Loa (heartfelt thanks) ~S~ Quote Link to comment https://forums.phpfreaks.com/topic/240663-help-on-email-submission-form/#findComment-1236094 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.