Can Someone Help me Please

This is a discussion on "Can Someone Help me Please" within the PHP Forum section. This forum, and the thread "Can Someone Help me Please are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 29th, 2007, 11:30
New Member
Join Date: May 2007
Location: England
Age: 16
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Can Someone Help me Please

Hi i need a Bit of Help With a PHP form Script i need someone to make me a Contact Script with layout like this

Name:
Email:
Send to :
Message:

The only Reason i cant do it is im a bit stuck making so they can select a member of my team to send it to
For Example member of my team name was Matt the name matt would be in the Drop Down list and it would send it to matt@site.com

I Hope you understand what i mean as i am only 14

Please Help Someone
Reply With Quote

  #2 (permalink)  
Old May 29th, 2007, 16:38
Reputable Member
Join Date: Mar 2005
Location: Margaritaville (a state of mind somewhere between Inebriation and San Diego), CA
Posts: 233
Thanks: 4
Thanked 0 Times in 0 Posts
Re: Can Someone Help me Please

I doubt very much that you're going to find someone to write it for you. If you were writing it and had a problem or question, you'd get plenty of help, but no one wants to help someone that doesn't want to help himself.

This should get you started:
PHP Form Help
If you need more than that, try:
http://www.google.com/search?q=php+contact+script

You can download the full php manual here:
http://www.php.net/download-docs.php
It's got lots of good examples and is an indispensable tool for learning php.

If you need help with the form/processing, try:
http://www.google.com/search?q=php+%22form+processing%22

Last edited by Donny Bahama; May 29th, 2007 at 16:40.
Reply With Quote
  #3 (permalink)  
Old May 29th, 2007, 20:36
Reputable Member
Join Date: Oct 2006
Location: UK
Age: 25
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cullinanweb Send a message via Skype™ to cullinanweb
Re: Can Someone Help me Please

I will have a go for you but you have to promise.......to learn PHP (as above) after i do.

Ok?

Lol, let me know
Reply With Quote
  #4 (permalink)  
Old May 31st, 2007, 07:54
New Member
Join Date: May 2007
Location: England
Age: 16
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can Someone Help me Please

Ok Thanks
Reply With Quote
  #5 (permalink)  
Old May 31st, 2007, 08:15
Junior Member
Join Date: May 2007
Location: United Kindom, London and the South East
Age: 17
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Bradster
Re: Can Someone Help me Please

http://www.ibdhost.com/contact/

Very nice tutorial on this there.
Reply With Quote
  #6 (permalink)  
Old May 31st, 2007, 08:52
New Member
Join Date: May 2007
Location: tehran
Age: 26
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Can Someone Help me Please

it's easy !the only thing u need is bit of PHP and mysql and dosen't take much time to learn
good luck
Reply With Quote
  #7 (permalink)  
Old May 31st, 2007, 10:17
Reputable Member
Join Date: Oct 2006
Location: UK
Age: 25
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to cullinanweb Send a message via Skype™ to cullinanweb
Re: Can Someone Help me Please

Right here we go, a simple('ish) form for you. It includes email validation which should always be used at an absolute minimum, and the select statement so you can add your team members. have tested it and it seems to work fine let me know if you need anything else.
Also I have commented it so you can follow whats going on. you need to add your emails and team members and also change the subject of the email ($subject)...
Code: Select all
<?php
     function check_email_address($email) {
  // First, we check that there's one @ symbol, and that the lengths are right
  if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
    // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
    return false;
  }
  // Split it into sections to make life easier
  $email_array = explode("@", $email);
  $local_array = explode(".", $email_array[0]);
  for ($i = 0; $i < sizeof($local_array); $i++) {
     if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
      return false;
    }
  }  
  if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
    $domain_array = explode(".", $email_array[1]);
    if (sizeof($domain_array) < 2) {
        return false; // Not enough parts to domain
    }
    for ($i = 0; $i < sizeof($domain_array); $i++) {
      if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
        return false;
      }
    }
  }
  return true;
}
    if(isset($_POST['submit'])) {
    //we set the variables
        $name         = $_POST['name'];
        $email         = $_POST['email'];
        $sendto     = $_POST['sendto'];
        $message     = $_POST['message'];

        //Enter your required email subject here
        $subject    = "Enter subject of email here";
        
        //here is where the message is formatted
        $body        = "New email has arrived from: ".$name." (".$email.")\n\nMessage\n------------------------------------------\n".$message;
        
        //first we check if a person is selected from the drop down
        if ($sendto != "nosend") {
        //now we check that the email address is valid
            if (check_email_address($email)) {
            //now we send the email
                mail($sendto, $subject, $body, "From:".$email);
                echo "Successfully sent email";
            } else {
                echo "Not a valid email address, please check and try again"; }
        } else {
            echo "Please select a person to send the email to"; }
    }
?>
<!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=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<form action="<?php PHP_SELF; ?>" method="post" enctype="multipart/form-data" name="contactform">
      <p>
           <label for="name">Name</label>
        <input type="text" name="name" id="name" />
      </p>
      <p>
           <label for="email">Email</label>
        <input type="text" name="email" id="email" />
    </p>
  <p>
       <label for="sendto">Send to</label>
       <select name="sendto" id="sendto">
         <option value="nosend" selected="selected">Please select...</option>
          <option value="mat@email.com">Matt</option>
          <option value="dave@email.com">Dave</option>
          <option value="cullinanweb@gmail.com">Test</option>
    </select>
  </p>
  <p>
        <label for="message">Message</label>
        <textarea name="message" id="message"></textarea>
  </p>
  <p>
        <input type="submit" name="submit" value="Submit" />
  </p>
</form>
</body>
</html>
Reply With Quote
Reply

Tags
php form help

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 01:49.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43