html php contact form

Hello

So this is probably a very easy question to most people but i have made a PHP contact from for a website im making and
when I press submit on the form the PHP isnt running and is just displaying a white page.

Here is my HTML code -
[php]

			    <p>Your Name </p>
			    <input type="text" name="name"  required=""/>
				
				
				<p>Your Email </p>
                                    <input type="email" name="email"  required=""/>
				
				
				<p>Mobile Number</p>
				<input type="tel" name="tell">
				
				
				<p>Date Requested</p> 
                                     <input type="date" name="date"  required=""/>
				
				
				<p>Service Required</p>
				<div class="select_join">
				<select name="service">
				<option value="MOT">MOT</option>
				<option value="Service">Service</option>
				<option value="Brakes">Brakes</option>
				<option value="Battery">Battery</option>
				</select>
				</div>
				
				
				<p>Your Message </p>
				<textarea name ="message" placeholder="" ></textarea>

				<input type="submit" name="submit" value="submit">
			
			</form>

and here is my PHP -

<?php if (isset($_POST["submit"])) { $to = '[email protected]'; $name = $_POST['name']; $email_address = $_POST['email']; $tell = $_POST['tell']; $date = $_POST['date']; $service = $_POST['service']; $message = $_POST['message']; $subject = "Website Booking Request"; $body = "You have received a new booking request. \n ". "Name: $name \n ". "Email: $email_address\n ". "Tell: $tell \n ". "Date: $date \n ". "Service: $tell \n ". "Message: $message"; mail($to, $subject, $body);} echo "Thank You!"; ?>[/php]

Any help would be appreciated, even if someone could give me a rough idea of whats wrong so i could work it out for myself.

Thanks :slight_smile:

There is an error in your php code. Turn error reporting on, and it will ahow you the issue with your brackets.

I agree with turning on error reporting and if you use a good IDE it will point on silly errors like brackets and what have you. Logic errors not so much and that is why they are the hardest to correct.

Sponsor our Newsletter | Privacy Policy | Terms of Service