Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 38

Thread: Form help

  1. #11
    Join Date
    Oct 2006
    Posts
    41
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi Medyman,

    I tried this and it's still not working. When I did the email test yesterday I did get an email that said "testing server mail support".

    This is what I still have on my html page (www.mysite.htm):
    Code:
    <form name="form1" action="formSender1.php"  method="post">
    
     <label for="firstname">First Name :</label>
     <input name="firstname" type="text" />
     <br />
     
     <label for="lastname">Last Name :</label>
     <input name="lastname" type="text" />
     <br />
     
      <label for="address">Address :</label>
      <input name="address" type="text" />
    <br />
    
      <label for="phonehome">Phone (home) :</label>
      <input name="phonehome" type="text" />
    <br />
    
    <label for="phonecell">Phone (cell) :</label>
    <input name=phonecell" type="text" />
    <br />
    
    <label for="emailaddress">Email Address :</label>
    <input name="emailaddress" type="text" />
    <br />
    
    <input type="reset" />
     <input type="submit" />
     
    </form>
    And on the page called formsender1.php:
    Code:
    <?php
    
    
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $address = $_POST['address'];
    $phonehome = $_POST['phonehome'];
    $phonecell = $_POST['phonecell'];
    $emailaddress = $_POST['emailaddress'];
    
       $to = "whatever@yahoo.com";   
       $subject = "Grill Form";   
       $body = "First name: ".$firstname."<br>";
       $body .= "Last name: ".$lastname."<br>"; 
       $body .= "Address: ".$address."<br>";
       $body .= "Home Phone: ".$phonehome."<br>";
       $body .= "Home (cell): ".$phonecell."<br>";
       $body .= "Email Address: ".$emailaddress."<br>";
     
       $from = $emailaddress;
    
     echo "To: ".$to; 
       echo "<br>Subject: ".$subject; 
       echo "<br><br>Message:<br> ".$body; 
       echo "<br><br>From: ".$from; 
        
    ?>
    Did I miss something obvious?
    Last edited by vacatia; 04-30-2008 at 12:55 AM.

  2. #12
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Well, for starters there is no formSender1.php in your root directory.

    Where are you placing the PHP file? Also, make sure the name is the exact same.

    For simplicity sake, why don't you rename the php file to sender.php, everything lowercased

    And change
    Code:
    <form name="form1" action="formSender1.php"  method="post">
    to

    Code:
    <form name="form1" action="sender.php"  method="post">
    Let me know if anything changes.

  3. #13
    Join Date
    Oct 2006
    Posts
    41
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Medyman View Post
    Well, for starters there is no formSender1.php in your root directory.

    Where are you placing the PHP file? Also, make sure the name is the exact same.

    For simplicity sake, why don't you rename the php file to sender.php, everything lowercased

    And change
    Code:
    <form name="form1" action="formSender1.php"  method="post">
    to

    Code:
    <form name="form1" action="sender.php"  method="post">
    Let me know if anything changes.


    Hi there,

    Ok I did exactly as you said and this time I'm getting another error but hey, at least it's something new! When I fill out the form I press submit I get a black page but when I highlighted it I saw the writing:


    Code:
    Notice: Undefined index: phonecell in /var/www/vhosts/mysite.ca/httpdocs/sender.php on line 16
    To: whatever@yahoo.com
    Subject: Grillm Form
    
    Message:
    First name: Lisa
    Last name: Tester
    Address: 5 Tester Ave
    Home Phone: 416-955-2132
    Home (cell): 
    Email Address: tester@tester.com
    
    
    From: tester@tester.com
    Last edited by vacatia; 04-30-2008 at 12:55 AM.

  4. #14
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Oh...that's right.

    There was another error in the html that dog posted. I forgot to mention it.

    Find:
    Code:
    <input name=phonecell" type="text" />
    and replace with:
    Code:
    <input name="phonecell" type="text" />
    It's missing a quotation mark.

    That *should* get it all working for you. What's left to do is place the original mail funciton and header redirect back in and take out the echos.

    Confirm that the quote fixed it and i'll tell you how to do the rest.

  5. The Following User Says Thank You to Medyman For This Useful Post:

    vacatia (04-27-2008)

  6. #15
    Join Date
    Oct 2006
    Posts
    41
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Oh my gosh, it actually worked!

    Even my thank you page showed up, thank you so much.

    Now I have 3 more questions

    1)is this fairly secure? I heard that Dagon Designs one was secure but is this secure too?
    2)The email I got in my inbox with the email came through kind of ugly like this:

    Code:
    tester@tes.com
    
    First name: Mister<br>Last name: Test<br>Address: 5 Tester Drive<br>Home Phone: 416-261-1211<br>Home (cell): 416-664-5124<br>Email Address: tester@tes.com<br>
    (tester@tes.com is the fake email I used)
    How do I get rid of those brs and stuff? In the future it won't be me viewing these emails it will be a person who isn't very computer literate at all and I don't want to confuse him.

    3)The email came into my inbox from "anonymous@****.ca", how do I get it to come from a different email address? I don't want people to reply to that email because it's not mine, I believe it's the gentleman who runs the server.

    Thanks once again

  7. #16
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    1. You could do a little more to make sure you're not getting blank emails, but it's *fairly* secure. That Dagon script is extremely secure (a little obsessively so).

    2. Replace the relevant code with this:

    Code:
    $to = "minielky@yahoo.com";
    $subject = "Grillmasters Form";
    $body = "First name: ".$firstname."\r\n\r\n";
    $body .= "Last name: ".$lastname."\r\n\r\n"; 
    $body .= "Address: ".$address."\r\n\r\n";
    $body .= "Home Phone: ".$phonehome."\r\n\r\n";
    $body .= "Home (cell): ".$phonecell."\r\n\r\n";
    $body .= "Email Address: ".$emailaddress."\r\n\r\n";
    There will now be 2 line breaks where the <br> tags are. If you only want one, replace \r\n\r\n with \r\n

    3. The from field is from the $from paramater. This should be working fine because the output you just posted has it included. Make sure you're setting a $from variable and that it's equal to $emailaddress.

    If it is, and still not working, try replacing $from with $emailaddress in the mail() function.


    Note: This script is set up so that you can recieve information submitted from your site. It does not send a message to the writer (unless you changed it). So, really the content of the "from" field doesn't really matter. You have the writer's email address in the body of the email, anyway.

  8. #17
    Join Date
    Oct 2006
    Posts
    41
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thanks once again for all your help. Of course I am returning with a couple more questions!

    1)What is the simplest way, to get a response email using this form when someone signs up? I just want a message email reply going back to the person who signed up saying "Thank you for joining, etc. etc."


    2)The two button options are "reset" and "submit query". How can I make the "submit query" say either "submit" or "join the club?"

    Hope you can help!

  9. #18
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    1. Use another mail() function

    Code:
    $auto_subject = "Thanks for signing up";
    $auto_body = "You have been registered.  Thank you!";
     mail($emailaddress, $auto_subject, $auto_body, $to);
    2. Add a value to the submit input

    Code:
    <input type="submit" value="Join the club" />

  10. #19
    Join Date
    Oct 2006
    Posts
    41
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi there,

    Ok changing the button names worked fine, thanks!

    I tested the auto-responder code and it doesn't seem to work yet-I signed up with my own email and never got the "thanks for joining!" auto-reply.

    This is what I have on sender.php:

    PHP Code:
    <?php


    $firstname 
    $_POST['firstname'];
    $lastname $_POST['lastname'];
    $address $_POST['address'];
    $city $_POST['city'];
    $province $_POST['province'];
    $postalcode $_POST['postalcode'];
    $phonehome $_POST['phonehome'];
    $phonecell $_POST['phonecell'];
    $emailaddress $_POST['emailaddress'];

       
    $to "clientemail@yahoo.com";   
       
    $subject "Sign Up Form";   
       
    $body "First name: ".$firstname."\r\n\r\n";
       
    $body .= "Last name: ".$lastname."\r\n\r\n"
       
    $body .= "Address: ".$address."\r\n\r\n";
       
    $body .= "City: ".$city."\r\n\r\n";
       
    $body .= "Province: ".$province."\r\n\r\n";
       
    $bidt .= "Postal Code: ".$postalcode."\r\n\r\n";
       
    $body .= "Home Phone: ".$phonehome."\r\n\r\n";
       
    $body .= "Home (cell): ".$phonecell."\r\n\r\n";
       
    $body .= "Email Address: ".$emailaddress."\r\n\r\n";
     
       
    $from $emailaddress;

    mail($to$subject$body$from); 
      
    header("Location: http://www.mysite.ca/thankyou.htm"); 
      exit;

    $auto_subject "Thanks for joining The Club!";
    $auto_body "Thank you for joining The Club.  Stay tuned for monthly emails about our upcoming features!";
    mail($emailaddress$auto_subject$auto_body$to);

    ?>

    Also, what's the easiest way to get the form boxes all lined up?

  11. #20
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    1. Add the code I gave above the header. So the bottom of your php file should look like this (I added comments to make it a little easier) :

    PHP Code:
    // Email Site Administrator 
    mail($to$subject$body$from); 

    // Auto-responder
    $auto_subject "Thanks for joining The Club!";
    $auto_body "Thank you for joining The Club.  Stay tuned for monthly emails about our upcoming features!";
    mail($emailaddress$auto_subject$auto_body$to);

    // Redirect
    header("Location: http://www.mysite.ca/thankyou.htm");

    // End Script
    exit;

    ?> 

    2. http://www.dynamicdrive.com/style/cs...ableless-form/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •