Jump to content

Need help with a html/php Form


mrainey

Recommended Posts

[move]!!!!!!HELP NEEDED ASAP!!!!!![/move]

 

Got A form that is in testing at the moment it all wroks except it doesn't show the info types in in the e-mail just shows the questions

 

http://www.mcrpgroup.com/test/dylan_thomas_theatre_booking_form.html

 

If you want the codeing just give me a shout but its now driving me insaine lol

 

Michael

MCR Photographers

MCRP Group

 

Link to comment
Share on other sites

http://mcrpgroup.com/test/index.html

 

Is the address sorry find php code below

 

<?php
if ($_POST['show'] != "" && $_POST['title'] && $_POST['first_name'] && $_POST['last_name'] && $_POST['address'] && $_POST['city'] && $_POST['postal_code'] && $_POST['telephone_number'] && $_POST['mobile_number'] && $_POST['email_address'] && $_POST['adult_tickets'] && $_POST['conssesstion_tickets'] && $_POST['members_tickets'] && $_POST['seating'] && $_POST['paying_for_tickets'] && $_POST['contact_preferance'] && $_POST['mailing_list'] && $_POST['join_us'] && $_POST['friend_of_theatre'] ) {
$subject="Dylan Thomas Theatre - Booking Form";
$ip=$_SERVER["REMOTE_ADDR"];
$host = $ip;
$mon=date(m);
$day=date(j);
$year=date(y);
$hour=date(g);
$min=date(i);
$sec=date(s);
$hour=$hour-2;
if($hour<=0) { $hour+=12; }
$ts = "$hour:$min:$sec on $day/$mon/$year";


$to="test@mcrpgroup.com";

$body="

Show = $show

Title = $title

Fisrt name = $first_name

Last Name = $last_name

Address = $address

City = $city

Postal Code = $postal_code

Telephone Number = $telephone_number

Mobile Number = $mobile_number

E-Maill Address = $email_address

Adult Tickets = $adult_tickets

Conssession Tickets = $conssesstion_tickets

Members Tickets = $members_tickets

Seating = $seating

How Will You Be Paying For these Tickets = $paying_for_tickets

How Would you prefer us to contact you? = $contact_preferance

Would you Like To join Our Mailing List for fourth comming shows? = $mailing_list

Would you like to Join Swansea little Theatre Company? = $join_us

Would You Like To Become A Friend of The Theatre? = $friend_of_theatre


Host: $host
Time: $ts";

$email = "From: Dylan Thomas Theatre - Online Booking <$to>";
mail($to, $subject, $body, $email);
?>

<html>
<head>
<title>Email Sent</title>
</head>
<body bgcolor="#ffffff" text="#666666">

<p> </p>
<center>
<table border="1" cellpadding="3" cellspacing="0" width="400" bordercolor="#919191" bgcolor="#E6E6E6">
  <tr>
    <td width="100%">
      <p><center><b><font color="#000000">Email was successfully sent to: Dylan Thomas Theatre Box Office
      
    </td>
  </tr>
</table>

</body>
</html>

<?php
} else {
?>

<html>
<head>
<title>Contact email error</title>
</head>

<body bgcolor="#ffffff" text="#666666">
<p><center>
<table border="1" cellpadding="3" cellspacing="0" width="400" bordercolor="#919191" bgcolor="#E6E6E6">
  <tr>
    <td width="100%">
		<center>
		<b>There was an error with processing the email.</b><br>
		<p>
		<font color="#FF0000">Errors where:</font><br>
		<?php
			If (!$_POST['show'])
				echo "Show field is empty<br>";

			If (!$_POST['title'])
				echo "Title field is empty<br>";

			If (!$_POST['first_name'])
				echo "Fisrt name field is empty<br>";

			If (!$_POST['last_name'])
				echo "Last Name field is empty<br>";

			If (!$_POST['address'])
				echo "Address field is empty<br>";

			If (!$_POST['city'])
				echo "City field is empty<br>";

			If (!$_POST['postal_code'])
				echo "Postal Code field is empty<br>";

			If (!$_POST['telephone_number'])
				echo "Telephone Number field is empty<br>";

			If (!$_POST['mobile_number'])
				echo "Mobile Number field is empty<br>";

			If (!$_POST['email_address'])
				echo "E-Maill Address field is empty<br>";

			If (!$_POST['adult_tickets'])
				echo "Adult Tickets field is empty<br>";

			If (!$_POST['conssesstion_tickets'])
				echo "Conssession Tickets field is empty<br>";

			If (!$_POST['members_tickets'])
				echo "Members Tickets field is empty<br>";

			If (!$_POST['seating'])
				echo "Seating field is empty<br>";

			If (!$_POST['paying_for_tickets'])
				echo "How Will You Be Paying For these Tickets field is empty<br>";

			If (!$_POST['contact_preferance'])
				echo "How Would you prefer us to contact you? field is empty<br>";

			If (!$_POST['mailing_list'])
				echo "Would you Like To join Our Mailing List for fourth comming shows? field is empty<br>";

			If (!$_POST['join_us'])
				echo "Would you like to Join Swansea little Theatre Company? field is empty<br>";

			If (!$_POST['friend_of_theatre'])
				echo "Would You Like To Become A Friend of The Theatre? field is empty<br>";

		?>
	<p>
	Email message wasn't sent
      
    </td>
  </tr>
</table>
</body>
</html>

<?php
}
?>

 

EDITED BY WILDTEEN88: Please wrap code within code tags (


). Thank you

Link to comment
Share on other sites

here is the html coding

 

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Dylan Thomas Theatre Booking Form</title>
</head>
<h1>Dylan Thomas Theatre - Booking Form;</h1>

<form method="post" action="dylan_thomas_theatre_booking_form.php"><font size="1" face="verdana">
Show:<br>
<select size="1" name="show" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26">
<option>Please Choose</option>
<option>Nude With Violin</option>
<option>Of Mice And Men</option>
<option>Test Show</option>
</select><br><br>
Title:<br>
<select size="1" name="title" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26">
<option>Mr</option>
<option>Mrs</option>
<option>Miss</option>
<option>Ms</option>
<option>Dr</option>
</select><br><br>
Fisrt Name:<br>
<input type="text" name="first_name" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26" value="">
<br><br>
Last Name:<br>
<input type="text" name="last_name" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26" value="">
<br><br>
Address:<br>
<textarea name="address" cols="40" rows="3" style="border: 1px solid #cccccc; background-color: #ffffff;"></textarea>
<br><br>
City:<br>
<input type="text" name="city" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26" value="">
<br><br>
Postal Code:<br>
<input type="text" name="postal_code" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26" value="">
<br><br>
Telephone Number:<br>
<input type="text" name="telephone_number" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26" value="">
<br><br>
Mobile Number:<br>
<input type="text" name="mobile_number" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26" value="">
<br><br>
E-Maill Address:<br>
<input type="text" name="email_address" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26" value="">
<br><br>
Adult Tickets:<br>
<select size="1" name="adult_tickets" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26">
<option>0</option>
<option>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>
<option>32</option>
<option>33</option>
<option>34</option>
<option>35</option>
<option>36</option>
<option>37</option>
<option>38</option>
<option>39</option>
<option>40</option>
<option>41</option>
<option>42</option>
<option>43</option>
<option>44</option>
<option>45</option>
<option>46</option>
<option>47</option>
<option>48</option>
<option>49</option>
<option>50</option>
</select><br><br>
Conssession Tickets:<br>
<select size="1" name="conssesstion_tickets" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26">
<option>0</option>
<option>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>
<option>32</option>
<option>33</option>
<option>34</option>
<option>35</option>
<option>36</option>
<option>37</option>
<option>38</option>
<option>39</option>
<option>40</option>
<option>41</option>
<option>42</option>
<option>43</option>
<option>44</option>
<option>45</option>
<option>46</option>
<option>47</option>
<option>48</option>
<option>49</option>
<option>50</option>
</select><br><br>
Members Tickets:<br>
<select size="1" name="members_tickets" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26">
<option>0</option>
<option>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>
<option>32</option>
<option>33</option>
<option>34</option>
<option>35</option>
<option>36</option>
<option>37</option>
<option>38</option>
<option>39</option>
<option>40</option>
<option>41</option>
<option>42</option>
<option>43</option>
<option>44</option>
<option>45</option>
<option>46</option>
<option>47</option>
<option>48</option>
<option>49</option>
<option>50</option>
</select><br><br>
Seating:<br>
<select size="1" name="seating" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26">
<option>Front (If Possible)</option>
<option>Middle (If Possible)</option>
<option>Back (If Possible)</option>
<option>Anywhere Availible</option>
</select><br><br>
How Will You Be Paying For these Tickets?:<br>
<select size="1" name="paying_for_tickets" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26">
<option>Credit/Debit Card</option>
</select><br><br>
How Would you prefer us to contact you?:<br>
<select size="1" name="contact_preferance" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26">
<option>Phone</option>
<option>Mobile</option>
<option>E-Mail</option>
</select><br><br>
Would you Like To join Our Mailing List for fourth comming shows?:<br>
<select size="1" name="mailing_list" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26">
<option>Yes</option>
<option>No</option>
</select><br><br>
Would you like to Join Swansea little Theatre Company?:<br>
<select size="1" name="join_us" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26">
<option>Yes</option>
<option>No</option>
<option>More Infomation needed</option>
</select><br><br>
Would You Like To Become A Friend of The Theatre?:<br>
<select size="1" name="friend_of_theatre" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26">
<option>Yes</option>
<option>No</option>
<option>More Infomation Needed</option>
</select><br><br>
<input type="submit" value="send" style="border: 1px solid #cccccc; background-color: #ffcccc;">
</p>
</font></form>


<body>
</body>
</html>

 

mod-edit: PLEASE use the CODE tags

Link to comment
Share on other sites

The problem is that the variables passed to the form processing script as the $_POST[] array.  While you correctly use $_POST variables to test if required inputs exist, the rest of your code assumes that the variables themselves also exist. While true in older php installations where register_globals was set to ON by default, recent php versions are more secure and register_globals is OFF by default.

 

A quick fix for your form processing script would be to extract all values from the $_POST[] array (with the extract() function). Doing it right is always better and more secure.

Link to comment
Share on other sites

This is the begining to the top part. Too much work. Your first call checks if show = false and the rest shows true. This will not send anything.

 

Here what I think will fix the first part. I don't know if the rest of the code you displayed is an example or if it is the actual code.

 

<?php
if ($_POST['show'] && $_POST['title'] && $_POST['first_name'] && $_POST['last_name'] && $_POST['address'] && $_POST['city'] && $_POST['postal_code'] && $_POST['telephone_number'] && $_POST['mobile_number'] && $_POST['email_address'] && $_POST['adult_tickets'] && $_POST['conssesstion_tickets'] && $_POST['members_tickets'] && $_POST['seating'] && $_POST['paying_for_tickets'] && $_POST['contact_preferance'] && $_POST['mailing_list'] && $_POST['join_us'] && $_POST['friend_of_theatre'] ) {
$subject="Dylan Thomas Theatre - Booking Form";
$ip=$_SERVER["REMOTE_ADDR"];
$host = $ip;
$mon=date(m);
$day=date(j);
$year=date(y);
$hour=date(g);
$min=date(i);
$sec=date(s);
$hour=$hour-2;

if($hour<=0) {
   $hour=+12;
} ?>

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.