View Single Post
Old 06-21-2009, 06:52 PM   #1 (permalink)
neonjuice
Registered User
 
neonjuice's Avatar
 
Join Date: Dec 2008
Location: Minnesota
Posts: 115
OS: Vista Ultimate 64 bit SP1. Linux Ubuntu, XP Pro


PHP Email form problem

Ok. I am stuck and I feel damn stupid for this.

I am making an email send form, that will contain several sections. Users email addy, phone number, question and several other options.

I have developed this PHP form,but unsure exactly where to put my email address for it to send all the info to my inbox. I have been working 4am shifts this week and tired, I just can not see where I am going wrong. Still learning PHP. I do currently have the form in place using XHTML, but wish to program with PHP mainly from now on. Plus I got to learn all this inside out for college, when I start in September.

Here is my PHP code.

Code:
<?php

/*variable names for xhtml input*/
$name = $HTTP_POST_VARS ['name'];
$email = $HTTP_POST_VARS['email'];
$phone = $HTTP_POST-VARS['phone'];
$contact_choice = $HTTP_POST_VARS ['contact'];
$quick_form = $HTTP_POST_VARS ['quickform'];
$time = $HTTP_POST_VARS ['time'];
$message = $HTTP_POST_VARS['message'];

if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email='example@example.com')) **
  echo "<h4>Invalid email address</h4>";
  echo "<a href='javascript:history.back(1);'>Back</a>";
} elseif ($message == "") **
  echo "<h4>You have not entered a message </h4>";
  echo "<a href='javascript:history.back(1);'>Back</a>";
}


elseif (mail($name,$email,$phone,$contact_choice,$quick_form,$time,$message )) **
  echo "<h4>Thank you for contacting us, you shall receive a reply very soon.</h4>";
} else **
  echo "<h4>Can't send email to $email</h4>";
}
?>
Here is my XHTML side of the code, just included the Form part of the code.

Code:
<$php
<form action="mail.php" method="POST">
<strong>Name:</strong>     <input type="text" size="10" maxlength="40" name="name" /> <br />
<br />
 <strong>Email: </strong>  <input type="text" size="10" maxlength="45" name="email" /><br />
 <br />
 <strong>Phone:</strong> <input type="text" size="10" maxlength="45" name="phone" /><br />

 <br />
 <br />
 <center><cite><u><strong>How would you like us to contact you?</strong></u></cite></center>
 <br />
 <input type="checkbox" name="email" value="email" /> Email
 <input type="checkbox" name="phone" value="phone" /> Phone
 <br />
 <br />

 <center><cite><u><strong>Select an option to help process your email quicker</strong></u></cite></center>
 <br />
    <input type="checkbox" name="quickform" value="t-shirts" />T-shirts
          <input type="checkbox" name="quickform" value="shorts" />Shorts
          <input type="checkbox" name="quickform" value="tank tops" />Tank tops
          <input type="checkbox" name="quickform" value="General Query" />General Query
          <br />
          <br />
          Best time to contact you? :
<select name="time" />
<option>Select Time</option>

<option>9am - 12 noon</option>
<option>Noon - 6pm</option>
<option>6pm - 9pm</option>
</select>
<br />
<br />
<textarea rows="10" cols="80" wrap="physical" name="message" />
Enter text here:
</textarea>
<br />
<br />
<input type="submit" value="Send" />
</form>
I think I may have gotten my self confused and would love some help from you guys.
It is near bed time,. back up at 3am for work. The 3 days off, to get this sorted and get lots of other work completed.
neonjuice is offline   Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here