So I am having a real problem getting PHP to work.
I have the below code:
Which I am just using a test here (http://digital-blacksmith.co.uk/set/contact.php) but the bloody thing will just not work, it doesn't give me anything.
Have I done some something obviously wrong with my code? I cannot see it and it's driving me insane.
I have the below code:
<?php
if(isset($_POST['submit_form'])){
if(isset($_POST['name']) && isset($_POST['email']) && isset($_POST['comments'])){
// Code to execute if everything is fine
}else{
$error="incomplete";
}
}
?>
<!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>Untitled Document</title>
</head>
<body>
<?php if(isset($error)){echo "<p>Please complete all of the required fields</p>";} ?>
<form method="post" action="contact.php">
Name*:<br /><input type="text" name="name" style="<?php if(isset($_POST['submit_form']) && !isset($_POST['name'])){echo "background:#b12828;";} ?>" /><br />
Email Address*:<br /><input type="text" name="email" style="<?php if(isset($_POST['submit_form']) && !isset($_POST['email'])){echo "background:#b12828;";} ?>" /><br />
Phone Number:<br /><input type="text" name="phone" style="<?php if(isset($_POST['submit_form']) && !isset($_POST['phone'])){echo "background:#b12828;";} ?>" /><br />
Comments*:<br /><textarea name="comments" style="<?php if(isset($_POST['submit_form']) && !isset($_POST['comments'])){echo "background:#b12828;";} ?>"></textarea><br />
<input type="submit" value="Submit" />
<input type="hidden" name="submit_form" value="y" />
</form>
</body>
</html>
Which I am just using a test here (http://digital-blacksmith.co.uk/set/contact.php) but the bloody thing will just not work, it doesn't give me anything.
Have I done some something obviously wrong with my code? I cannot see it and it's driving me insane.