I’m having a problem with my php, it was working fine the other day but now… well, now it isn’t and I don’t know what I did. I’m fairly new to php so sorry if this is an obvious mistake.
I’m trying to make a contact page like this;
HTML:
[code]
1. Name
2.<label> Email Address</label>
<input type="text" name="email" autocomplete="off" value="<?php echo $_POST['email']?>">
<label> and/or Phone Number</label>
<input type="text" name="phone" autocomplete="off" value="<?php echo $_POST['phone']?>">
3.<label> Message</label>
<textarea name="message"><?php echo $_POST['message']?></textarea>
<br /> <br /> <br />
<div id="submit">
<input type="submit" name="send" value="Send">
</div>
</form>[/code]
PHP: [php]<?php
if(isset($_post[‘send’])){
$name = $_post[‘name’];
$email = $_post[‘email’];
$phone = $_post[‘phone’];
$message = $_post[‘message’];
if($name == ""){
echo "<br />", "please provide your name.";
}
if(($phone=="") and ($email=="")){
echo "<br /> please enter a valid email address/phone number.";
}
if(($phone=="") and (strpos($email, '@')==false) and ($email!="")){
echo "<br /> please enter a valid email address/phone number.";
}
if((is_numeric ($phone)==false) and ($email=="") and ($phone!="")){
echo "<br /> please enter a valid email address/phone number.";
}
if((is_numeric ($phone)==false) and (strpos($email, '@')==false) and ($phone!=="") and ($email !="")){
echo "<br /> please enter a valid email address/phone number.";
}
if ($message == ""){
echo "<br />", "please enter a message.";
}
if (($name != "") and ($message != "") and (is_numeric ($phone)==true) and (strpos($email, '@')==false)){
echo "<br /> test(phone)";
mail("[email protected]", "New Message from the website", "Name: ".$name." Phone: ".$phone." Message: ".$message);
}
if (($name != "") and ($message != "") and (strpos($email, '@')==true) and (is_numeric ($phone)==false)){
echo "<br /> test(mail)";
mail("[email protected]", "New Message from the website", "Name: ".$name." Email: ".$email." Message: ".$message);
}
if (($name != "") and ($message != "") and (strpos($email, '@')==true) and (is_numeric ($phone)==true)){
echo "<br /> test(both)";
mail("[email protected]", "New Message from the website", "Name: ".$name." Email: ".$email." Phone: ".$phone." Message: ".$message);
}
}
?>[/php]
I’ve put them both together and saved them as a php file, uploaded them to my site but now all of a sudden it doesn’t work. Any help is appreciated!