CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   HTML & CSS (http://www.codingforums.com/forumdisplay.php?f=13)
-   -   need some help with form (http://www.codingforums.com/showthread.php?t=227839)

learninghard 05-26-2011 02:56 AM

need some help with form
 
hi im kind new to codes and im starting get confused ,
how can i get the option selected and send at end of message of form on that code?
example:
if option selected is "<OPTION value="grm@test.com" >test Card</OPTION>" this fomr will send a email to that value ,but i want but put at end of "menssage_txt" or at end of email that a text like this "option selected was test card". :confused:
Code:

  ... <tr>
                <td colspan="2">Select the area:                 
                  <select name="dSac[emailto_txt]">
                    <option>----------------- </option>
          <OPTION value="sac@test.com" selected>SAC</OPTION>
          <OPTION value="grm@test.com"                    >test Card</OPTION>
          <OPTION value="compras@test.com"    >Comercial</OPTION>
          <OPTION value="diretoria@test.com"  >Diretoria</OPTION>
          <OPTION value="financeiro@test.comr"  >Financeiro</OPTION>
          <OPTION value="informatica@test.com" >Inform&aacute;tica</OPTION>
          <OPTION value="vania@test.com, marcel@test.com, Jordan@test.com" >Jurídico</OPTION>
          <OPTION value="marketing@test.com"  >Marketing</OPTION>
          <OPTION value="dp@test.com"          >RH</OPTION>                   
                </select></td>
              </tr>
              <tr>
                <td colspan="2">leave a text here.</td>
              </tr>
              <tr>
                <td colspan="2"><textarea  name="dSac[menssage_txt]" cols="75" rows="5" wrap="off"></textarea></td>
              </tr>
              <tr>
                <td width="80">&nbsp;</td>
                <td><input type="Submit" value="&nbsp;&nbsp;Enviar&nbsp;&nbsp;" /></td>
              </tr>
            </table>
            </form>
...


Jethro 05-26-2011 03:05 AM

Not quite sure what you are after but the select name value will be set to the value of the selected option. Are you using a scripting language after the form is submitted?

For example in php it would be something like

$email_text = mysql_real_escape_string($_POST[dSac['emailto_txt]']);

HTH

bullant 05-26-2011 05:08 AM

If this is for a "real world" application, are you sure you want to expose email addresses in your html?

Email address harvesters (bots) will swallow those up very quickly and say "YiuUUuumy - thank you very much".

Why not have some other values like company names, or whatever, as the option values and then when the selected option is sent to your server side form processing script you can get the associated email address for the selected option from a database, array, text file or whatever and then send the email with its message to the email address.

learninghard 05-26-2011 05:05 PM

Quote:

Originally Posted by bullant (Post 1094519)
If this is for a "real world" application, are you sure you want to expose email addresses in your html?

Email address harvesters (bots) will swallow those up very quickly and say "YiuUUuumy - thank you very much".

...

it will be a intranet service that im testing for now i dont have the rights to use the sql to put that in ,so i cant make any big changes


All times are GMT +1. The time now is 11:51 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.