'Contact Me' page


#1

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>&nbsp;&nbsp;&nbsp;&nbsp;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("sharonfrancis@gmx.com", "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("sharonfrancis@gmx.com", "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("sharonfrancis@gmx.com", "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!


#2

Hi,

what “doesn’t work” ? To start I noticed your form has no ‘action’ property. So basically on submit it won’t know what to do. ( It will call its own URL AFAIK ) This will most likely happen completely quiet because there are no errors ( nothing goes wrong, just nothing happens )
If you do get errors, let us know. Errors are noisy for a reason.

Hope it helps.
O.


#3

Well, this line is not correct!

echo “
”, “please provide your name.”;

No comma, it should be a period!