maciek4 Posted May 4, 2006 Share Posted May 4, 2006 I have a form. The user clicks on checkbox and combo box is activated. He selects the value in the combo box from 1 to 5 (which indicated importance factor) and the value is sent by email. the problem is that the value is not sent and I dont know why. Anybody knows how to fix it?[code]$need = array();$importance = array(); $importance[0] = $_POST["importance"]; $importance[1] = $_POST["importance1"];[/code][code]$mailBody .= "I need english to:\n\n"; if(isset($need['friend'])) {$mailBody .= "- social reasons\n"; $mailBody .= "Importance: ".$importance[0]."\n\n";} if(isset($need['sell'])) {$mailBody .= "- sale and negotiations\n"; $mailBody .= "Importance: ".$importance[1]."\n\n";}[/code][code]<form action="analize_rq.html" method="post" name="order">[/code][code]<INPUT TYPE="checkbox" NAME="need[friend]" value="friend" onclick="javascript:document.order.importance.disabled=false" <? echo isset($need['friend']) ? 'checked' : ''; ?> > social reasons<br><select disabled="true" name="importance"> <option value="0" <? echo ($importance[0] == '0' ? 'selected' : '') ?>>-</option> <option value="1" <? echo ($importance[0] == '1' ? 'selected' : '') ?>>1</option> <option value="2" <? echo ($importance[0] == '2' ? 'selected' : '') ?>>2</option> <option value="3" <? echo ($importance[0] == '3' ? 'selected' : '') ?>>3</option> <option value="4" <? echo ($importance[0] == '4' ? 'selected' : '') ?>>4</option> <option value="5" <? echo ($importance[0] == '5' ? 'selected' : '') ?>>5</option> </select><INPUT TYPE="checkbox" NAME="need[sell]" value="sell" onclick="javascript:document.order.importance1.disabled=false"<? echo isset($need['sell']) ? 'checked' : ''; ?>> sales and negotiations<br><select name="importance1" disabled="true"> <option value="0" <? echo ($importance[1] == '0' ? 'selected' : '') ?>>-</option> <option value="1" <? echo ($importance[1] == '1' ? 'selected' : '') ?>>1</option> <option value="2" <? echo ($importance[1] == '2' ? 'selected' : '') ?>>2</option> <option value="3" <? echo ($importance[1] == '3' ? 'selected' : '') ?>>3</option> <option value="4" <? echo ($importance[1] == '4' ? 'selected' : '') ?>>4</option> <option value="5" <? echo ($importance[1] == '5' ? 'selected' : '') ?>>5</option> </select>[/code] Link to comment https://forums.phpfreaks.com/topic/9044-sending-values-of-combo-boxes-by-email/ Share on other sites More sharing options...
ansarka Posted May 4, 2006 Share Posted May 4, 2006 let me confirm your requirementYou have a form i which ther is two combo boxes and when i click submit the the selected combobx values should be send to the email .I want to ask you wheather you want to select a single value from a combo box or multiple values Link to comment https://forums.phpfreaks.com/topic/9044-sending-values-of-combo-boxes-by-email/#findComment-33252 Share on other sites More sharing options...
maciek4 Posted May 4, 2006 Author Share Posted May 4, 2006 [!--quoteo(post=371203:date=May 4 2006, 01:22 PM:name=anuka)--][div class=\'quotetop\']QUOTE(anuka @ May 4 2006, 01:22 PM) [snapback]371203[/snapback][/div][div class=\'quotemain\'][!--quotec--]let me confirm your requirementYou have a form i which ther is two combo boxes and when i click submit the the selected combobx values should be send to the email .I want to ask you wheather you want to select a single value from a combo box or multiple values[/quote]correctsingle value.The options are 1-5. It looks like thissocial reasons (checkbox) importance (combo box)sales and negotiations (checkbox) importance (combo box)If I click on checkbox 1 ----> compbobox 1 is activated and I can select a value there. If I select values 1 in combobox 1 and 5 in combobox 2, in the email I should getsocial reasons: importance: 1sales and negotiations:importance: 5 Link to comment https://forums.phpfreaks.com/topic/9044-sending-values-of-combo-boxes-by-email/#findComment-33254 Share on other sites More sharing options...
ansarka Posted May 4, 2006 Share Posted May 4, 2006 [code]<?$need = array();$importance = array(); $importance[0] = $_POST["importance"]; $importance[1] = $_POST["importance1"]; $mailBody = "I need english to:\n\n"; if(isset($need['friend'])) { $mailBody .= "- social reasons\n"; $mailBody .= "Importance: ".$importance[0]."\n\n"; } if(isset($need['sell'])) { $mailBody .= "- sale and negotiations\n"; $mailBody .= "Importance: ".$importance[1]."\n\n"; } $mail_to = "[email protected]"; //To mail which is retrieved form the data base$mail_from = "[email protected]"; //From mail $mail_subject = "Details12";//subject header/* To send HTML mail, you can set the Content-type header. */$headers = "MIME-Version: 1.0\n"; //setting the mime version. To send the html we have to set MIME ver 1.0######################################################################### IMP IF THIS CODE DOESNT WORK ADD \r\n INSTEAD OF \n IN HEADERS#######################################################################$headers .= "Content-type: text/html; charset=iso-8859-1\n"; //for send ing the html file/* additional headers */$headers .= "From: Ansar<[email protected]>\n"; //headers from address//$headers .= "Cc: [email protected]\n";//$headers .= "Bcc: [email protected]\n";//$body=htmlentities($body);//Function to send mail mail($mail_to,$mail_subject,$mailBody,$headers); ?> <form action="<?=PHP_SELF?>" method="post" name="order"> <p> <INPUT TYPE="checkbox" NAME="need[friend]" value="friend" onclick="javascript:document.order.importance.disabled=false" <? echo isset($need['friend']) ? 'checked' : ''; ?> > social reasons<br> <select disabled="true" name="importance"> <option value="0" <? echo ($importance[0] == '0' ? 'selected' : '') ?>>-</option> <option value="1" <? echo ($importance[0] == '1' ? 'selected' : '') ?>>1</option> <option value="2" <? echo ($importance[0] == '2' ? 'selected' : '') ?>>2</option> <option value="3" <? echo ($importance[0] == '3' ? 'selected' : '') ?>>3</option> <option value="4" <? echo ($importance[0] == '4' ? 'selected' : '') ?>>4</option> <option value="5" <? echo ($importance[0] == '5' ? 'selected' : '') ?>>5</option> </select> </p> <p> <INPUT TYPE="checkbox" NAME="need[sell]" value="sell" onclick="javascript:document.order.importance1.disabled=false"<? echo isset($need['sell']) ? 'checked' : ''; ?>> sales and negotiations<br> <select name="importance1" disabled="true"> <option value="0" <? echo ($importance[1] == '0' ? 'selected' : '') ?>>-</option> <option value="1" <? echo ($importance[1] == '1' ? 'selected' : '') ?>>1</option> <option value="2" <? echo ($importance[1] == '2' ? 'selected' : '') ?>>2</option> <option value="3" <? echo ($importance[1] == '3' ? 'selected' : '') ?>>3</option> <option value="4" <? echo ($importance[1] == '4' ? 'selected' : '') ?>>4</option> <option value="5" <? echo ($importance[1] == '5' ? 'selected' : '') ?>>5</option> </select> <input type="submit" name="Submit" value="Submit"> </p></form>[/code]TRY THIS CODE Link to comment https://forums.phpfreaks.com/topic/9044-sending-values-of-combo-boxes-by-email/#findComment-33255 Share on other sites More sharing options...
maciek4 Posted May 4, 2006 Author Share Posted May 4, 2006 [!--quoteo(post=371206:date=May 4 2006, 01:31 PM:name=anuka)--][div class=\'quotetop\']QUOTE(anuka @ May 4 2006, 01:31 PM) [snapback]371206[/snapback][/div][div class=\'quotemain\'][!--quotec--][code]<?$need = array();$importance = array(); $importance[0] = $_POST["importance"]; $importance[1] = $_POST["importance1"]; $mailBody = "I need english to:\n\n"; if(isset($need['friend'])) { $mailBody .= "- social reasons\n"; $mailBody .= "Importance: ".$importance[0]."\n\n"; } if(isset($need['sell'])) { $mailBody .= "- sale and negotiations\n"; $mailBody .= "Importance: ".$importance[1]."\n\n"; } $mail_to = "[email protected]"; //To mail which is retrieved form the data base$mail_from = "[email protected]"; //From mail $mail_subject = "Details12";//subject header/* To send HTML mail, you can set the Content-type header. */$headers = "MIME-Version: 1.0\n"; //setting the mime version. To send the html we have to set MIME ver 1.0######################################################################### IMP IF THIS CODE DOESNT WORK ADD \r\n INSTEAD OF \n IN HEADERS#######################################################################$headers .= "Content-type: text/html; charset=iso-8859-1\n"; //for send ing the html file/* additional headers */$headers .= "From: Ansar<[email protected]>\n"; //headers from address//$headers .= "Cc: [email protected]\n";//$headers .= "Bcc: [email protected]\n";//$body=htmlentities($body);//Function to send mail mail($mail_to,$mail_subject,$mailBody,$headers); ?> <form action="<?=PHP_SELF?>" method="post" name="order"> <p> <INPUT TYPE="checkbox" NAME="need[friend]" value="friend" onclick="javascript:document.order.importance.disabled=false" <? echo isset($need['friend']) ? 'checked' : ''; ?> > social reasons<br> <select disabled="true" name="importance"> <option value="0" <? echo ($importance[0] == '0' ? 'selected' : '') ?>>-</option> <option value="1" <? echo ($importance[0] == '1' ? 'selected' : '') ?>>1</option> <option value="2" <? echo ($importance[0] == '2' ? 'selected' : '') ?>>2</option> <option value="3" <? echo ($importance[0] == '3' ? 'selected' : '') ?>>3</option> <option value="4" <? echo ($importance[0] == '4' ? 'selected' : '') ?>>4</option> <option value="5" <? echo ($importance[0] == '5' ? 'selected' : '') ?>>5</option> </select> </p> <p> <INPUT TYPE="checkbox" NAME="need[sell]" value="sell" onclick="javascript:document.order.importance1.disabled=false"<? echo isset($need['sell']) ? 'checked' : ''; ?>> sales and negotiations<br> <select name="importance1" disabled="true"> <option value="0" <? echo ($importance[1] == '0' ? 'selected' : '') ?>>-</option> <option value="1" <? echo ($importance[1] == '1' ? 'selected' : '') ?>>1</option> <option value="2" <? echo ($importance[1] == '2' ? 'selected' : '') ?>>2</option> <option value="3" <? echo ($importance[1] == '3' ? 'selected' : '') ?>>3</option> <option value="4" <? echo ($importance[1] == '4' ? 'selected' : '') ?>>4</option> <option value="5" <? echo ($importance[1] == '5' ? 'selected' : '') ?>>5</option> </select> <input type="submit" name="Submit" value="Submit"> </p></form>[/code]TRY THIS CODE[/quote]so what has changed in the code? I don't see any changes. Link to comment https://forums.phpfreaks.com/topic/9044-sending-values-of-combo-boxes-by-email/#findComment-33257 Share on other sites More sharing options...
ansarka Posted May 4, 2006 Share Posted May 4, 2006 [!--quoteo(post=371208:date=May 4 2006, 06:45 AM:name=Poland)--][div class=\'quotetop\']QUOTE(Poland @ May 4 2006, 06:45 AM) [snapback]371208[/snapback][/div][div class=\'quotemain\'][!--quotec--]so what has changed in the code? I don't see any changes.[/quote]Check the code complty before making any comments i hve added some extra code to your code plz check each and every lin in the php tag Link to comment https://forums.phpfreaks.com/topic/9044-sending-values-of-combo-boxes-by-email/#findComment-33259 Share on other sites More sharing options...
maciek4 Posted May 4, 2006 Author Share Posted May 4, 2006 why not highlight the extra code? It would make it easier to find.I believe you only added this part:$mail_to = "[email protected]"; //To mail which is retrieved form the data base$mail_from = "[email protected]"; //From mail$mail_subject = "Details12";//subject header/* To send HTML mail, you can set the Content-type header. */$headers = "MIME-Version: 1.0\n"; //setting the mime version. To send the html we have to set MIME ver 1.0######################################################################### IMP IF THIS CODE DOESNT WORK ADD \r\n INSTEAD OF \n IN HEADERS#######################################################################$headers .= "Content-type: text/html; charset=iso-8859-1\n"; //for send ing the html file/* additional headers */$headers .= "From: Ansar<[email protected]>\n"; //headers from address//$headers .= "Cc: [email protected]\n";//$headers .= "Bcc: [email protected]\n";//$body=htmlentities($body);//Function to send mailmail($mail_to,$mail_subject,$mailBody,$headers); ?>I already have a function to send mail and it works correctly, the problem that I have is that the value from the combo box is not being sent. In my email I am getting this:Social reasons:Importance:Sales and negotiations:Importance:no value in the importance. Link to comment https://forums.phpfreaks.com/topic/9044-sending-values-of-combo-boxes-by-email/#findComment-33264 Share on other sites More sharing options...
ansarka Posted May 4, 2006 Share Posted May 4, 2006 if(isset($need['friend'])) { $mailBody .= "- social reasons\n"; $mailBody .= "Importance:[i] $importance[0] [/i]\n\n"; } if(isset($need['sell'])) { $mailBody .= "- sale and negotiations\n"; $mailBody .= "Importance:[i] $importance[1] [/i]\n\n"; } Link to comment https://forums.phpfreaks.com/topic/9044-sending-values-of-combo-boxes-by-email/#findComment-33273 Share on other sites More sharing options...
maciek4 Posted May 4, 2006 Author Share Posted May 4, 2006 [!--quoteo(post=371224:date=May 4 2006, 02:42 PM:name=anuka)--][div class=\'quotetop\']QUOTE(anuka @ May 4 2006, 02:42 PM) [snapback]371224[/snapback][/div][div class=\'quotemain\'][!--quotec--]if(isset($need['friend'])) { $mailBody .= "- social reasons\n"; $mailBody .= "Importance:[i] $importance[0] [/i]\n\n"; } if(isset($need['sell'])) { $mailBody .= "- sale and negotiations\n"; $mailBody .= "Importance:[i] $importance[1] [/i]\n\n"; }[/quote][code]$mailBody .= "I need english to:\n\n"; if(isset($need['friend'])) {$mailBody .= "- social reasons\n"; $mailBody .= "Importance: ".$importance[0]."\n\n";} if(isset($need['sell'])) {$mailBody .= "- sale and negotiations\n"; $mailBody .= "Importance: ".$importance[1]."\n\n";}[/code]same thing. Already have it. Link to comment https://forums.phpfreaks.com/topic/9044-sending-values-of-combo-boxes-by-email/#findComment-33274 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.