hazenship Posted May 22, 2011 Share Posted May 22, 2011 I'm using the same php script for my contact page and booking page I need a different one for both but I pasted my booking form below with my mailer.php. When I change the name of the php and redirect the form I get syntax errors. Also I need to make Name Email and Phone number required. Some one please help. <?php $to = ""; $subject = "Results from your Request Info form"; $headers = "From: Tampabayfishingcharters.net"; $forward = 0; $location = ""; $date = date ("l, F jS, Y"); $time = date ("h:i A"); $msg = "Below is the result of your feedback form. It was submitted on $date at $time.\n\n"; if ($_SERVER['REQUEST_METHOD'] == "POST") { foreach ($_POST as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; } } else { foreach ($_GET as $key => $value) { $msg .= ucfirst ($key) ." : ". $value . "\n"; } } mail($to, $subject, $msg, $headers); if ($forward == 1) { header ("Location:$location"); } else { header("Location: http://www.tampabaychartering.com"); exit (); } ?> <hr> <form action="mailer.php" method="post"> <form method="POST" action="tampabaychartering.com/booking.html"> <p align="left"> <b><font face="Comic Sans MS" size="4" color="#003366">Type of Charter <select size="1" name="type_of_charter"> <option selected>Flats Fishing</option> <option>Inshore Fishing</option> <option>Offshore Fishing</option> </select></font></b></p> <p align="left"> <b><font face="Comic Sans MS" size="4" color="#003366">Have you fished with me before? <select size="1" name="have_fished_with_you_before"> <option>yes</option> <option selected>no</option> </select></font></b></p> <p align="left"><font face="Comic Sans MS" size="4" color="#003366"><b>How many days do you want to fish? </b></font><b> <font face="Comic Sans MS" size="4" color="#003366"> <select size="1" name="days_you_want_to_fish"> <option selected>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> </font></b></p> <p align="left"><b><font color="#003366" size="4" face="Comic Sans MS">How Long of a trip do you want <select size="1" name="how_long_do_you_want_to_fish"> <option selected>Full Day Flats $450</option> <option>Full Day Inshore $450</option> <option>Full Day Offshore $650</option> </select></font></b></p> <p align="left"><b><font face="Comic Sans MS" size="4" color="#003366">How many people in your party? For parties of more than 4 please call before booking.<select size="1" name="how_many_people"> <option>1</option> <option selected>2</option> <option>3</option> <option>4</option> </select></font></b></p> <p align="left" style="margin-top:"> <b><font face="Comic Sans MS" size="4" color="#003366">How many adults? <select size="1" name="adults_in_group"> <option selected>1</option> <option>2</option> <option>3</option> <option>4</option> </select> How Many children under 12? <select size="1" name="number_of_children"> <option>0</option> <option>1</option> <option>2</option> <option>3</option> </select></font></b></p> <p align="left"><b><font color="#003366" size="4" face="Comic Sans MS">Choose the date Of your Charter.</font></b></p> <p align="left"><b><font color="#003366" face="Comic Sans MS" size="4"> <select size="1" name="Charter_Date"> <option selected>January</option> <option>February</option> <option>March</option> <option>April</option> <option>May</option> <option>June</option> <option>July</option> <option>August</option> <option>September</option> <option>October</option> <option>November</option> <option>December</option> </select> <select size="1" name="day"> <option selected>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> </select> <select size="1" name="year"> <option selected="">2011</option> <option>2012</option> <option>2013</option> <option>2014</option> </select></font></b></p> <p align="left"><b><font face="Comic Sans MS" size="4" color="#003366">Payment method preffered for deposit?<select size="1" name="Deposit_Payment_Method"> <option>Credit Card</option> <option selected>Money Order</option> </select></font></b></p> <p><strong><font color="#003366" size="4" face="Comic Sans MS">How can I get in touch with you?</font></strong></p> <dl> <dd> <table height="150"> <tr> <td height="27"> <p align="left"><b> <font size="4" face="Comic Sans MS" color="#003366">Name </font></b> <td height="27"> <p align="left"> <font face="Comic Sans MS" size="4"><b><font color="#003366"> <input type="text" size="35" maxlength="256" name="name"> </font></b><font color="#FF0000">required</font><b><font color="#003366"> </font></b></font> </tr> <tr> <td height="27"> <p align="left"><b> <font size="4" face="Comic Sans MS" color="#003366">E-mail </font> </b> <td height="27"> <p align="left"><font face="Comic Sans MS" size="4"><b> <font color="#003366"> <input type="text" size="35" maxlength="256" name="Email"> </font></b></font> </tr> <tr> <td height="27"> <p align="left"><b> <font size="4" face="Comic Sans MS" color="#003366">Home </font></b> <td height="27"> <p align="left"> <font face="Comic Sans MS" size="4"><b><font color="#003366"> <input type="text" size="35" maxlength="256" name="Home_number"> </font></b><font color="#FF0000">required 10 digits </font><font color="#003366"> </font></font></tr> <tr> <td height="27"> <b><font size="4" face="Comic Sans MS" color="#003366">Work</font></b><td height="27"> <font size="4" face="Comic Sans MS" color="#003366"><b> <input type="text" size="35" maxlength="256" name="Work_number"></b></font></tr> <tr> <td height="27"> <p align="left"><b> <font size="4" face="Comic Sans MS" color="#003366">Cell</font></b><td height="27"> <p align="left"> <font face="Comic Sans MS" size="4"><b><font color="#003366"> <input type="text" size="35" maxlength="256" name="User_cell "> </font></b></font> </tr> </table> </dd> </dl> <p align="left"><font face="Comic Sans MS"><b><font size="4" color="#003366">What is the best time to call? </font></b> <font color="#003366"><b><font size="4">From</font></b></font></font><font face="Comic Sans MS" size="4"><b><font color="#003366"><select size="1" name="best_time_to_call"> <option selected>8am</option> <option>9am</option> <option>10am</option> <option>11am</option> <option>12am</option> <option>1pm</option> <option>2pm</option> <option>3pm</option> <option>4pm</option> <option>5pm</option> <option>6pm</option> <option>7pm</option> <option>8pm</option> <option>9pm</option> <option>10pm</option> </select> </font></b></font><font face="Comic Sans MS"> <b> <font size="4" color="#003366">To </font></b></font> <font face="Comic Sans MS" size="4"><b><font color="#003366"><select size="1" name="until"> <option>8am</option> <option>9am</option> <option>10am</option> <option>11am</option> <option>12am</option> <option>1pm</option> <option>2pm</option> <option>3pm</option> <option>4pm</option> <option>5pm</option> <option>6pm</option> <option>7pm</option> <option>8pm</option> <option>9pm</option> <option selected>10pm</option> </select> </font></b></font> <p align="left"><b><font face="Comic Sans MS" size="4" color="#003366">How would you prefer to be contacted? <select size="1" name="Prefer_to_be_contacted_by"> <option selected>Home Phone</option> <option>Work Phone</option> <option>Cell Phone</option> <option>E-mail</option> </select></font></b><p align="left"><b> <font color="#003366" face="Comic Sans MS" size="4">What time zone are you in <select size="1" name="Time_zone"> <option selected>Eastern</option> <option>Central</option> <option>Mountain</option> <option>Pacific</option> <option>Out of USA</option> </select></font></b><p align="left"><font color="#FF0000" size="4"><b>Questions or comments about your trip</b></font></p> <p align="left"><textarea rows="5" name="Comments" cols="67"></textarea></p> <p align="left"> </p> <p align="left"> <b> <font color="#003366" size="4" face="Comic Sans MS">We will contact you as soon as possible to finish Booking your fishing trip.</font></b></p> <p> <input type="submit" value="Submit"> <input type="reset" value="Clear Form"></p> </form> MOD EDIT: code tags added Quote Link to comment https://forums.phpfreaks.com/topic/237125-need-help-with-php/ Share on other sites More sharing options...
Pikachu2000 Posted May 22, 2011 Share Posted May 22, 2011 When posting code, enclose it within the forum's . . . BBCode tags. Quote Link to comment https://forums.phpfreaks.com/topic/237125-need-help-with-php/#findComment-1218717 Share on other sites More sharing options...
Pikachu2000 Posted May 22, 2011 Share Posted May 22, 2011 You've nested 2 <form> tags. That typically causes problems. Fix that issue and try it again. Quote Link to comment https://forums.phpfreaks.com/topic/237125-need-help-with-php/#findComment-1218720 Share on other sites More sharing options...
hazenship Posted May 22, 2011 Author Share Posted May 22, 2011 Took out the additional form tag changed the mailer.php to booking.php on booking form changed to booking.php and get this error on submit Parse error: syntax error, unexpected $end in /home/content/02/6475202/html/tampabay2/booking.php on line 31 Quote Link to comment https://forums.phpfreaks.com/topic/237125-need-help-with-php/#findComment-1218722 Share on other sites More sharing options...
Pikachu2000 Posted May 22, 2011 Share Posted May 22, 2011 Is the script posted above "booking.php"? If it is, post the current revision of it, otherwise post booking.php since that's the file indicated in the error. Quote Link to comment https://forums.phpfreaks.com/topic/237125-need-help-with-php/#findComment-1218724 Share on other sites More sharing options...
hazenship Posted May 22, 2011 Author Share Posted May 22, 2011 booking.php is a mirror of mailer.php exact same code just a changed name if I use mailer.php goes through fine if I change the name of the php file and redirect the form to the booking.php same file as mailer.php I get that error. Don't understand. Quote Link to comment https://forums.phpfreaks.com/topic/237125-need-help-with-php/#findComment-1218726 Share on other sites More sharing options...
Pikachu2000 Posted May 22, 2011 Share Posted May 22, 2011 If one file throws a parse error, and the other does not, then it doesn't stand to reason that they are identical. Without actually seeing the contents of booking.php, all I can do is guess that there's a missing closing } curly brace or missing quote somewhere in the file. Quote Link to comment https://forums.phpfreaks.com/topic/237125-need-help-with-php/#findComment-1218727 Share on other sites More sharing options...
hazenship Posted May 22, 2011 Author Share Posted May 22, 2011 Correct you were ok now on to the next issue I need to make Name Phone and Email required just use the code I already listed what would I add to make fields required? Thank you on first part. Quote Link to comment https://forums.phpfreaks.com/topic/237125-need-help-with-php/#findComment-1218732 Share on other sites More sharing options...
hazenship Posted May 22, 2011 Author Share Posted May 22, 2011 Anyone I Need help? need to make fields required Quote Link to comment https://forums.phpfreaks.com/topic/237125-need-help-with-php/#findComment-1218754 Share on other sites More sharing options...
wildteen88 Posted May 22, 2011 Share Posted May 22, 2011 Look for PHP validation tutorials. There isn't a built in function which will do it all for you. Quote Link to comment https://forums.phpfreaks.com/topic/237125-need-help-with-php/#findComment-1218771 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.