Results 1 to 2 of 2
-
5th Dec 2010, 07:59 AM #1OPProbation
contact.php need guide
Please help me expect my code.
here is the GUI
Code:<?php if(!$_POST) exit; $email = $_POST['email']; $error[] = preg_match('/\b[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b/i', $_POST['email']) ? '' : 'INVALID EMAIL ADDRESS'; if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email )){ $error.="Invalid email address entered, please re-enter your email. example : test@email.com"; $errors=1; } if($errors==1) echo $error; else{ $values = array ('name','email','message'); $required = array('name','email','message'); $your_email = "karyawansufi@gmail.com"; $email_subject = "New Message"; $email_content = "new message:\n"; for( $i = 0 ; $i < count( $values ) ; ++$i ) { for( $c = 0 ; $c < count( $required ) ; ++$c ) { if( $values[$i]==$required[$c] ) { echo $required[$x]; if( empty($_POST[$values[$i]]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; } } } $email_content .= $values[$i].': '.$_POST[$values[$i]]."\n"; } foreach($values as $value){ if(in_array($value,$required)){ if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; } $email_content .= $value.': '.$_POST[$value]."\n"; } } if(mail($your_email,$email_subject,$email_content)) { echo 'Message sent!'; } else { echo 'ERROR!'; } } ?>
pLu18 Reviewed by pLu18 on . contact.php need guide Please help me expect my code. here is the GUI http://i1203.photobucket.com/albums/bb392/ezhekhyel89/th_Capture.jpg <?php if(!$_POST) exit; $email = $_POST; Rating: 5
-
5th Dec 2010, 11:51 AM #2MemberWebsite's:
epicimagehost.comIts the weirdest contact page i've seen so far.
I've quickly written this one instead.
I'm not sure it works. As I dont use the build-in mail function.
It also wont check the email adress to be valid..
But atleast now you got something.. IF this works
PHP Code:<?php
if(!empty($_POST['sendmail'])){
if(strlen($_POST['email']) < 3)
die('No email found');
if(strlen($_POST['content']) < 3)
die('No content found');
$to = 'youremail@email.com' ; // Replace this with your email
$subject = 'New Message';
$content = 'New Message from '.$_POST['email'].' :'."\n\n".$_POST['content'];
if(mail($to,$subject,$content))
echo 'sent';
else
echo 'failed';
}else{
?>
<html>
<head>
<title>
Mail Form
</title>
</head>
<body>
<form method="post">
<input type="text" name="email" value="your email" /><br />
<textarea name="content"></textarea><br />
<input type="submit" name="sendmail" value="sendmail" />
</form>
</body>
</html>
<?php
}
?>
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[Guide] Warez Starter Guide For *n00bs* :D
By CyberAff in forum Tutorials and GuidesReplies: 19Last Post: 14th Nov 2012, 03:01 PM -
contact page
By Beingvish in forum General DiscussionReplies: 3Last Post: 17th Nov 2010, 01:37 PM -
Contact Us
By King in forum vBulletinReplies: 1Last Post: 29th Apr 2009, 07:57 PM
themaCreator - create posts from...
Version 3.57 released. Open older version (or...