SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Aug 2005
    Location
    Belgium
    Posts
    387
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    contact form with select item

    Hello,
    I have this contact form, and everything works, but there is also an select option, where you can pick one of the possibilitys.
    This doesn't get mailed.

    Can someone tell me how to do this? I've never used it before, so I have no idea.

    This is how the code looks like:

    PHP Code:
        // type
        
    echo "\t\t<label>type:</label>";
        echo 
    "\t\t<select name=\"type\" class=\"inputDefault\">
        <option value=\"" 
    $_POST['type'] . "\">first</option>
        <option value=\"" 
    $_POST['type'] . "\">second</option>
        <option value=\"" 
    $_POST['type'] . "\">third</option>
        </select>"
    ;

        
    // pages
        
    echo "\t\t<label>pages:</label>"
        echo 
    "\t\t<input type=\"text\" name=\"pages\" value=\"" $_POST['pages'] . "\" class=\"inputDefault\">\n"
    Now the "pages part, gets is being sent when the form is submitted, but the "type" isn't.

    This is where it gets mailed:

    PHP Code:
        $inhoud_mail .= "type: "$_POST['type'] . "\n";
        
    $inhoud_mail .= "pages: "$_POST['pages'] . "\n"

    Can someone tell me what I'm doing wrong please?

    Thanks!

  2. #2
    SitePoint Member nabil_kadimi's Avatar
    Join Date
    Nov 2006
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Can you please explain what you want to do with your script?
    Is it to send emails?? There is no email function in your form!!

  3. #3
    SitePoint Enthusiast
    Join Date
    Apr 2006
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    have you done a 'view source' on your form page to see that the select option values are not blank?

  4. #4
    Dinah-Moe Humm mudshark's Avatar
    Join Date
    Dec 2003
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's the use of a dropdown menu when $_POST['type'] only holds one single value? Could it be that $_POST['type'] is in fact an array?

  5. #5
    SitePoint Addict
    Join Date
    Aug 2005
    Location
    Belgium
    Posts
    387
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,

    Thanks for replying, I think I explaind it wrong.

    That was just a part of the mail form.
    Anyway, problem was, I didn't need to use $_POST['type'] but just fill in the value, i thought that by filling $_POST['type'] in the value, it would pass the selected item in the form.

    Thanks!


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
  •