malok 10-02-2008, 03:41 PM 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>
mlseim 10-02-2008, 06:33 PM In your PHP script, do you have a line that looks like this?
blah blah = $_POST['da1'];
malok 10-03-2008, 02:37 AM 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'];
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
abduraooft 10-03-2008, 02:50 AM $da1 = $_POST['dropdown']; As mlseim mentioned, the above should be
$da1 = $_POST['da1'];, since the name of your dropdown is da1
malok 10-03-2008, 08:59 AM I did also that but with the same result.
malok 10-03-2008, 09:00 AM 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.
malok 10-03-2008, 09:03 AM I must say that the original script , does not have the dropdown menu and I add it by myselfe .
mlseim 10-03-2008, 01:41 PM 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).
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.
<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
<form method="post" name="contFrm" id="contFrm" onsubmit="return jcap();" action="name of script here">
bazz
malok 10-04-2008, 06:15 AM 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>
abduraooft 10-04-2008, 06:57 AM Hi malok, please wrap your code in ][/COLOR] tags while posting here. You may edit your recent posts in this forum.
mlseim 10-04-2008, 08:30 PM The latest script you're showing us has no "select" box in it.
malok 10-05-2008, 04:15 PM <!-- 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
$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%" 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;"> </td>
</tr>
</table>
<p> </p>
<p style="text-align:center;">
</div> <!-- /contentForm -->
mlseim 10-05-2008, 08:29 PM $name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$da1 = $_POST['da1'];
$message = $message . "Option Selected: ". $da1;
malok 10-06-2008, 12:11 PM wowwwwwwwwwwww
The form works fine now.
many thanks for helping for this issue.
Regards
|