Submit FORM something [Need help ASAP!]

Discussion in 'Web Programming' started by d great one, Dec 2, 2008.

Submit FORM something [Need help ASAP!]
  1. Unread #1 - Dec 2, 2008 at 4:33 AM
  2. d great one
    Joined:
    Nov 4, 2007
    Posts:
    930
    Referrals:
    2
    Sythe Gold:
    0

    d great one Apprentice

    Submit FORM something [Need help ASAP!]

    [​IMG]

    So this is my form.
    I need to learn quick how to format my submit button, make it work. Like when I input a data... it will be sent to my email or maybe it will display the stuffs I input.

    To give you easy time to help, I don't know PHP. But I know basic c++.
    I don't get how to work it.
    I tried reading all day for tutorials, but my time has run out. I need to make it work quickly.
    So PLEASE (yes, I am begging) somebody help me. Or maybe a quick tutorial will do so I can learn (which would help a lot).

    Please consider, I have a deadline to finish and I don't have much time.
    Thanks!
     
  3. Unread #2 - Dec 2, 2008 at 8:45 AM
  4. Furbster4
    Joined:
    Jun 16, 2008
    Posts:
    24
    Referrals:
    0
    Sythe Gold:
    0

    Furbster4 Newcomer

    Submit FORM something [Need help ASAP!]

    sorry double posted :(
     
  5. Unread #3 - Dec 2, 2008 at 8:48 AM
  6. Furbster4
    Joined:
    Jun 16, 2008
    Posts:
    24
    Referrals:
    0
    Sythe Gold:
    0

    Furbster4 Newcomer

    Submit FORM something [Need help ASAP!]

    when the button is clicked... make it run this...

    Code:
    <?php
    
    //Change these to fit properly
    $first_name = $_POST['firstname'];
    $last_name = $_POST['lastname'];
    //You can add the rest
    
    $to      = '[email protected]';
    $subject = 'New User';
    $message = $first_name." ".$last_name;
    $headers = 'From: [email protected]' . "\r\n" .
        'Reply-To: [email protected]' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    mail($to, $subject, $message, $headers);
    ?>
    
    then just go to that page, when someone hits the send button, provided you set it up to do what you want, then it'll e-mail everything you want it to, to you. :)
     
  7. Unread #4 - Dec 3, 2008 at 6:30 AM
  8. d great one
    Joined:
    Nov 4, 2007
    Posts:
    930
    Referrals:
    2
    Sythe Gold:
    0

    d great one Apprentice

    Submit FORM something [Need help ASAP!]

    I don't get how to run this PHP with the button.
     
  9. Unread #5 - Dec 3, 2008 at 7:13 AM
  10. Furbster4
    Joined:
    Jun 16, 2008
    Posts:
    24
    Referrals:
    0
    Sythe Gold:
    0

    Furbster4 Newcomer

    Submit FORM something [Need help ASAP!]

    Code:
    <?php
    
    if (isset($_POST['form'])) {
    	$surname = $_POST['surname'];
    	$first_name = $_POST['first_name'];
    	$initial = $_POST['initial'];
    	$address = $_POST['address'];
    	$contact_number1 = $_POST['contact_number1'];
    	$contact_number2 = $_POST['contact_number2'];
    	$contact_number3 = $_POST['contact_number3'];
    	$emailaddress = $_POST['email_address'];
    	$product_number1 = $_POST['product_number1'];
    	$product_number2 = $_POST['product_number2'];
    	$product_number3 = $_POST['product_number3'];
    	$product_number4 = $_POST['product_number4'];
    	$comments = $_POST['comments'];
    	
    	$layout = "Mr. ".$first_name." ".$initial." ".$surname." who lives at ".$address." which can be reached on ".$contact_number1." who's e-mail address is ".$emailaddress." has the product number ".$product_number1." and says ".$comments."
    	
    	$to      = '[email protected]';
    	$subject = 'New User';
    	$message = $layout
    	$headers = 'From: [email protected]' . "\r\n" .
        'Reply-To: [email protected]' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();
    
    	mail($to, $subject, $message, $headers);
    }
    else {
    	echo "<form name=\"form\" action=\"#\" method=\"post\">
    		<b>Family Name</b> <input type=\"text\" name=\"surname\" value=\"\"><br>
    		<b>First Name</b> <input type=\"text\" name=\"first_name\" value=\"\"><br>
    		<b>Middle Name Initial</b> <input type=\"text\" name=\"initial\" value=\"\"><br>
    		<b>Home Address</b> <input type=\"text\" name=\"address\" value=\"\"><br>
    		<b>Contact Number</b> <input type=\"text\" name=\"contact_number1\" value=\"\"><br>
    		<b>Contact Number</b> <input type=\"text\" name=\"contact_number2\" value=\"\"><br>
    		<b>Contact Number</b> <input type=\"text\" name=\"contact_number3\" value=\"\"><br>
    		<b>Email Address</b> <input type=\"text\" name=\"email_address\" value=\"\"><br>
    		<b>Product Number</b> <input type=\"text\" name=\"product_number1\" value=\"\"><br>
    		<b>Product Number</b> <input type=\"text\" name=\"product_number2\" value=\"\"><br>
    		<b>Product Number</b> <input type=\"text\" name=\"product_number3\" value=\"\"><br>
    		<b>Product Number</b> <input type=\"text\" name=\"product_number4\" value=\"\"><br>
    		<b>Comments</b> <textarea></textarea><br>
    		<input type=\"submit\" value=\"Submit\"><input type=\"reset\" value=\"Restart\">";
    }
    ?>
    
    Give that a shot :)
     
< Need PHP/MySQL Ideas! | Homepage >

Users viewing this thread
1 guest


 
 
Adblock breaks this site