Jump to content

Help on eMail submission form


mynahbird

Recommended Posts

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 = "register@yoursite.com";
$EmailTo = "info@yoursite.com";

$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~  :'(

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

u should do a date picker for date purchased for the rest of that code it looks alright to me  :confused:

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..

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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~ 8)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.