Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Contact Form

Featured Replies

Can anyone help

 

<?php
$fname = $_Post['fname'];
$email = $_Post['email'];
$telephone = $_Post['telephone'];
$date = $_Post['date'];
$collection = $_Post['collection'];
$rcollect = $_Post['rcollect'];
$seats = $_Post['seats'];
$destination = $_Post['destination'];
$interest = $_Post['interest'];
$like = $_Post['like'];
$time = $_Post['time'];
$method = $_Post['method'];
$tc = $_Post['tc'];
$formcontent="From: $fname, \n Telephone: $telephone, \n Date: $date, \n Collection Point: $collection, \n Collection Time from destination: $rcollect, \n Number of Seats: $seats, \n Destination: $destination, \n Interested In: $interest, \n Would Like A: $like, \n Best Time To Call: $time, \n Pereferred Method: $method, \n T&C Accpetance: $tc";
$recipient = "david@davidcook.me";
$subject = "Contact Form from Website";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader)or die("Error!");
echo "Thank You someone will be in contact in 24 hours";
?>

 

this is the php.

 

<form method="post" action="contact.php" name="" >
				<table>
					<tbody>
						<tr>
							<td>
								<span class="wtxt">Full Name: </span>
							</td>
							<td class="wtxt">Email: </td>
						</tr>
						<tr>
							<td>
								<input name="fname" type="text" class="textfield" id="fname" />
							</td>
							<td>
								<input name="email" type="text" class="textfield" id="email"/>
							</td>
						</tr>
						<tr>
							<td class="wtxt">Telephone: </td>
							<td class="wtxt">Date: </td>
						</tr>
						<tr>
							<td>
								<input name="telephone" type="text" class="textfield" id="telephone" />
							</td>
							<td>
								<input name="date" type="text" class="textfield" id="date" />
							</td>
						</tr>
						<tr>
							<td class="wtxt">Collection Point & Time: </td>
							<td class="wtxt">Time to collect from destination: </td>
						</tr>
						<tr>
							<td>
								<input name="collection" type="text" class="textfield" id="collection" />
							</td>
							<td>
								<input name="rcollect" type="text" class="textfield" id="rcollect" />
							</td>
						</tr>
						<tr>
							<td class="wtxt">Number of Seats Required: </td>
							<td class="wtxt">Destination: </td>
						</tr>
						<tr>
							<td>
								<input name="seats" type="text" class="textfield" id="seats" />
							</td>
							<td>
								<input name="destination" type="text" class="textfield" id="destination" />
							</td>
						</tr>
						<tr>
							<td class="wtxt">I'm interested in: </td>
							<td class="wtxt">I would like: </td>
						</tr>
						<tr>
							<td>
								<select name="interest" id="interest" class="selectfield">
									<option value="Select Reason" selected="selected">Select</option>
									<option value="School Hire">School Hire</option>
									<option value="Sports Hire">Sports Hire</option>
									<option value="Private Hire">Private Hire</option>
								</select>
							</td>
							<td>
								<select name"like" id="like" class="selectfield">
									<option value="Select Time" selected="selected">Select</option>
									<option value="A Callback">Callback</option>
									<option value="A Free Survey">Quote</option>
								</select>
							</td>
						</tr>
						<tr>
							<td class="wtxt">Best Time to call: </td>
							<td class="wtxt">Preferred method: </td>
						</tr>
						<tr>
							<td>
								<select name="time" id="time" class="selected">
									<option value="Select Time" selected="selected">Select Time</option>
									<option value="Anytime">Anytime</option>
									<option value="Day Time">Day Time</option>
									<option value="Evening">Evening</option>
								</select>		
							</td>
							<td>
								<select name="method" id="method" class="selected">
									<option value="Select Time" selected="selected">Select</option>
									<option value="Phone Call">Phone Call</option>
									<option value="Email">Email</option>
								</select>
							</td>
						</tr>
						<tr>
							<td class="wtxt">T&C Acceptance: <br/> <a href="tc.html" style="color:white">Terms & Conditions</a></td>
						</tr>
						<tr>
							<td>
								<input name="tc" type="radio" class="textfield" id="terms" />
							</td>
						</tr>
						<tr>
							<td colspan="2">
								<input name="Submit" type="submit" class="button" value="Submit"/>
							</td>
						</tr>
					</tbody>
				</table>
			</form>

 

the forms sends, however all the fields are blank.

 

anyone able ago help.

Not sure where to start commenting on - there are a number of errors in your script. To start with you need to be looking for the $_POST variable. Then you need to check if anything is actually entered in the form as at the moment the email will be sent even if no data is entered. There is also a missing equals sign on this line.

<select name"like" id="like" class="selectfield">

Correct these errors, do some validation and then report back.

  • Author

thanks Andy it works now.

 

thanks

 

How would I go about creating this

 

Terms & Conditions: (client needs to type I accept) in the box.

 

thanks

Edited by David Cook

<input type="checkbox" name="terms" value="accept">
if (isset($_POST['terms']) && $_POST['terms'] == "accept"){
// Accepted terms
} else {
// Did not accept terms
}

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.