Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    New Coder
    Join Date
    Sep 2008
    Posts
    19
    Thanks
    3
    Thanked 1 Time in 1 Post

    drop down menu on phpform does not send

    I have the form below in php file but it does not send the item selected from drop down menu,what is wrong in it...
    do I have to add some coding for in xtml or.....
    thanks for any help
    ----------------------------------------------------

    <form method="post" name="contFrm" id="contFrm" onsubmit="return jcap();" action="">


    <div class="float-left"><span class="required">*</span> 名字:</div>
    <input name="name" type="text" class="box" id="name" size="30" value="<?=$name;?>" />

    <div class="float-left"><span class="required">*</span> eメール: </div>
    <input name="email" type="text" class="box" id="email" size="30" value="<?=$email;?>" />

    <div class="float-left"><span class="required">*</span> 件名: </div>
    <input name="subject" type="text" class="box" id="subject" size="30" value="<?=$subject;?>" />

    <div class="float-left"><span class="required">*</span> メッセージ: </div>
    <p>
    <textarea name="message" cols="40" rows="3" id="message"><?=$message;?>
    </textarea>
    </p>
    <p>
    <select name="da1">
    <option value="pro3">pro3</option>
    <option value="pro2">pro2</option>
    <option value="pro1">pro1</option>
    </select>
    <br />
    <br />

    <!-- Submit Button-->
    <input name="send" type="submit" class="button" id="send" value="" onclick="return checkForm();" />

    </p>
    </form>

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,467
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    In your PHP script, do you have a line that looks like this?

    blah blah = $_POST['da1'];

  • #3
    New Coder
    Join Date
    Sep 2008
    Posts
    19
    Thanks
    3
    Thanked 1 Time in 1 Post
    the below is included in the script and added $da1 = ''; // dropdown

    but it does not work
    -----------------------------------------

    <?php
    $error = ''; // error message
    $name = ''; // sender's name
    $email = ''; // sender's email address
    $subject = ''; // subject
    $message = ''; // the message itself
    $da1 = ''; // dropdown

    if(isset($_POST['send']))
    {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];
    $da1 = $_POST['dropdown'];

  • #4
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    did you rermove the action value in the first line of the form, for the purposes of posting?

    If so, then I would start by disabling the two javascripts (onsubmit and onclick) and see if they are the cause of the difficulty.

    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    $da1 = $_POST['dropdown'];
    As mlseim mentioned, the above should be
    PHP Code:
    $da1 $_POST['da1']; 
    , since the name of your dropdown is da1
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #6
    New Coder
    Join Date
    Sep 2008
    Posts
    19
    Thanks
    3
    Thanked 1 Time in 1 Post
    I did also that but with the same result.

  • #7
    New Coder
    Join Date
    Sep 2008
    Posts
    19
    Thanks
    3
    Thanked 1 Time in 1 Post
    Quote Originally Posted by bazz View Post
    did you rermove the action value in the first line of the form, for the purposes of posting?

    If so, then I would start by disabling the two javascripts (onsubmit and onclick) and see if they are the cause of the difficulty.

    bazz
    No Have not remove anything.

  • #8
    New Coder
    Join Date
    Sep 2008
    Posts
    19
    Thanks
    3
    Thanked 1 Time in 1 Post
    I must say that the original script , does not have the dropdown menu and I add it by myselfe .

  • #9
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,467
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    So you made changes and it still does not work ...

    Re list your current form and PHP script so we can
    see how it is right now (non working).

  • #10
    Master Coder
    Join Date
    Apr 2003
    Location
    in my house
    Posts
    5,211
    Thanks
    39
    Thanked 201 Times in 197 Posts
    Quote Originally Posted by malok View Post
    No Have not remove anything.
    OK then, you may ahve several issues. One of them appears to be this line where the action must be the location of the file which will process the form submission.
    Code:
    <form method="post" name="contFrm" id="contFrm" onsubmit="return jcap();" action="">
    If the script you have is meant to be used for processing the submission then enter its url between the quotes like this
    Code:
    <form method="post" name="contFrm" id="contFrm" onsubmit="return jcap();" action="name of script here">
    bazz
    "The day you stop learning is the day you become obsolete"! - my late Dad.

    Why do some people say "I don't know for sure"? If they don't know for sure then, they don't know!
    Useful MySQL resource
    Useful MySQL link

  • #11
    New Coder
    Join Date
    Sep 2008
    Posts
    19
    Thanks
    3
    Thanked 1 Time in 1 Post
    Thanks for your comments.
    The below is the entire code please take a look where should I add the dropdown menu,the submit action works fine but the only problem is it does not show the selected item after receiving the mail.
    ------------------------------------------------------------------------
    <body>
    <div id="contentForm">

    <!-- The contact form starts from here-->
    <?php
    $error = ''; // error message
    $name = ''; // sender's name
    $email = ''; // sender's email address
    $subject = ''; // subject
    $message = ''; // the message itself

    if(isset($_POST['send']))
    {
    $name = $_POST['name'];
    $email = $_POST['email'];
    $subject = $_POST['subject'];
    $message = $_POST['message'];

    if(trim($name) == '')
    {
    $error = '<div class="errormsg">Please enter your name!</div>';
    }
    else if(trim($email) == '')
    {
    $error = '<div class="errormsg">Please enter your email address!</div>';
    }
    else if(!isEmail($email))
    {
    $error = '<div class="errormsg">You have enter an invalid e-mail address. Please, try again!</div>';
    }
    if(trim($subject) == '')
    {
    $error = '<div class="errormsg">Please enter a subject!</div>';
    }
    else if(trim($message) == '')
    {
    $error = '<div class="errormsg">Please enter your message!</div>';
    }
    if($error == '')
    {
    if(get_magic_quotes_gpc())
    {
    $message = stripslashes($message);
    }

    // the email will be sent here
    // make sure to change this to be your e-mail
    $to = "yourmail@here.com";

    // the email subject
    // '[Contact Form] :' will appear automatically in the subject.
    // You can change it as you want

    $subject = '[Contact Form] : ' . $subject;

    // the mail message ( add any additional information if you want )
    $msg = "From : $name \r\ne-Mail : $email \r\nSubject : $subject \r\n\n" . "Message : \r\n$message";

    mail($to, $subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n");
    ?>

    <!-- Message sent! (change the text below as you wish)-->
    <div style="text-align:center;">
    <h1>Congratulations!!</h1>
    <p>Thank you <b><?=$name;?></b>, your message is sent!</p>
    </div>
    <!--End Message Sent-->


    <?php
    }
    }

    if(!isset($_POST['send']) || $error != '')
    {
    ?>

    <h1>Contact Form Example:</h1>
    <!--Error Message-->
    <?=$error;?>

    <form method="post" name="contFrm" id="contFrm" onsubmit="return jcap();" action="">


    <div class="float-left"><span class="required">*</span> Full Name:</div>
    <input name="name" type="text" class="box" id="name" size="30" value="<?=$name;?>" />

    <div class="float-left"><span class="required">*</span> Email: </div>
    <input name="email" type="text" class="box" id="email" size="30" value="<?=$email;?>" />

    <div class="float-left"><span class="required">*</span> Subject: </div>
    <input name="subject" type="text" class="box" id="subject" size="30" value="<?=$subject;?>" />

    <div class="float-left"><span class="required">*</span> Message: </div>
    <textarea name="message" cols="40" rows="3" id="message"><?=$message;?></textarea><br /><br />

    <!-- Submit Button-->
    <input name="send" type="submit" class="button" id="send" value="" onclick="return checkForm();" />

    </form>

    <!-- E-mail verification. Do not edit -->
    <?php
    }

    function isEmail($email)
    {
    return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn |bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk| dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs |gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr| kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum |mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr |pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf |tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za| zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i"
    ,$email));
    }
    ?>
    <!-- END CONTACT FORM -->


    </div> <!-- /contentForm -->

    </body>

  • #12
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Hi malok, please wrap your code in [php][/php] tags while posting here. You may edit your recent posts in this forum.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #13
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,467
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    The latest script you're showing us has no "select" box in it.

  • #14
    New Coder
    Join Date
    Sep 2008
    Posts
    19
    Thanks
    3
    Thanked 1 Time in 1 Post
    <!-- The contact form starts from here-->
    PHP Code:
    <?php
                     $error    
    ''// error message
                     
    $name     ''// sender's name
                     
    $email    ''// sender's email address
                     
    $subject  ''// subject
                     
    $message  ''// the message itself
             
    $da1      ''// da1

                
    if(isset($_POST['send']))
                {
                     
    $name     $_POST['name'];
                     
    $email    $_POST['email'];
                     
    $subject  $_POST['subject'];
                     
    $message  $_POST['message'];
             
    $da1      $_POST['da1'];

                    if(
    trim($name) == '')
                    {
                        
    $error '<div class="errormsg">お名前をご入力ください。</div>';
                    }
                        else if(
    trim($email) == '')
                    {
                        
    $error '<div class="errormsg">メールアドレスをご入力ください。</div>';
                    }
                    else if(!
    isEmail($email))
                    {
                        
    $error '<div class="errormsg">メールアドレスが無効です。ご確認の上、再度ご入力ください。
                        </div>'
    ;
                    }
                        if(
    trim($subject) == '')
                    {
                        
    $error '<div class="errormsg">件名をご入力ください。</div>';
                    }
                    else if(
    trim($message) == '')
                    {
                        
    $error '<div class="errormsg">メッセージ(本文)をご入力ください。</div>';
                    }
                    if(
    $error == '')
                    {
                        if(
    get_magic_quotes_gpc())
                        {
                            
    $message stripslashes($message);
                        }

                        
    // the email will be sent here
                        // make sure to change this to be your e-mail
                        
    $to      "support@eexpertbiz.com";

                        
    // the email subject
                        // '[Contact Form] :' will appear automatically in the subject.
                        // You can change it as you want

                        
    $subject '[Contact Form] : ' $subject;

                        
    // the mail message ( add any additional information if you want )
                        
    $msg     "From : $name \r\ne-Mail : $email \r\nSubject : $subject \r\n\n" "Message : \r\n$message";

                        
    mail($to$subject$msg"From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n");
                
    ?>

                      <!-- Message sent! (change the text below as you wish)-->
           <div style="text-align:center;">
                        <h3><b>
                        <?=$name;?>
                        </b> 様 ありがとうございました。</h3>
           </div>
                      <!--End Message Sent-->


                <?php
    }
    }

    if(!isset($_POST['send']) || $error != '')
    {
    ?>
    <form method="post" name="contFrm" id="contFrm" onsubmit="return jcap();" action="">


    <div class="float-left"><span class="required">*</span> 名字:</div>
    <input name="name" type="text" class="box" id="name" size="30" value="<?=$name;?>" />

    <div class="float-left"><span class="required">*</span> eメール: </div>
    <input name="email" type="text" class="box" id="email" size="30" value="<?=$email;?>" />

    <div class="float-left"><span class="required">*</span> 件名: </div>
    <input name="subject" type="text" class="box" id="subject" size="30" value="<?=$subject;?>" />

    <div class="float-left"><span class="required">*</span> メッセージ: </div>
    <p>
    <textarea name="message" cols="40" rows="3" id="message"><?=$message;?>
    </textarea>
    </p>
    <p>
    <br />
    <br />

    <!-- Submit Button-->
    <input name="send" type="submit" class="button" id="send" value="" onclick="return checkForm();" />

    </p>
    </form>

    <!-- E-mail verification. Do not edit -->
    <?php
    }

    function isEmail($email)
    {
    return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn |bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk| dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs |gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr| kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum |mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr |pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf |tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za| zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i"
    ,$email));
    }
    ?>
    <!-- END CONTACT FORM -->
    <p align="center" class="redbold">上記フォームが使えないときは下記メールをご利用下さい。</p>
    <table width="100&#37;" border="0" cellspacing="0" cellpadding="0" align="center" style="height:116px;">
    <tr>
    <td width="18" align="right"><div align="right"><img src="/images/support_mail.gif" width="163" height="13" /></div></td>
    <td "><div align="center" class="profiplan">技術的なお問合せ</div></td>
    </tr>
    <tr>
    <td><div align="right"><img src="/images/info_mail.gif" width="136" height="13" /></div></td>
    <td style="height:40px; padding-right:10px;"><div align="center" class="profiplan">一般的なご質問、お問合せ</div></td>
    </tr>
    <tr>
    <td colspan="2" align="right" style="padding-right:10px; padding-top:6px;">&nbsp;</td>
    </tr>
    </table>
    <p>&nbsp;</p>
    <p style="text-align:center;">

    </div> <!-- /contentForm -->
    Last edited by malok; 10-06-2008 at 12:27 PM. Reason: editting

  • #15
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,467
    Thanks
    8
    Thanked 1,085 Times in 1,076 Posts
    PHP Code:
    $name     $_POST['name']; 
    $email    $_POST['email']; 
    $subject  $_POST['subject']; 
    $message  $_POST['message']; 
    $da1      $_POST['da1']; 

    $message $message "Option Selected: "$da1

  • Users who have thanked mlseim for this post:

    malok (10-06-2008)


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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