Activity Stream
48,167 MEMBERS
64255 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 2 of 2
  1.     
    #1
    Probation

    Exclamation 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

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    epicimagehost.com
    Its 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
    }
    ?>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Guide] Warez Starter Guide For *n00bs* :D
    By CyberAff in forum Tutorials and Guides
    Replies: 19
    Last Post: 14th Nov 2012, 03:01 PM
  2. contact page
    By Beingvish in forum General Discussion
    Replies: 3
    Last Post: 17th Nov 2010, 01:37 PM
  3. Contact Us
    By King in forum vBulletin
    Replies: 1
    Last Post: 29th Apr 2009, 07:57 PM

Tags for this Thread

BE SOCIAL