Link to home
Start Free TrialLog in
Avatar of Ernesto
ErnestoFlag for Mexico

asked on

get name for asp on select

<form method="post" action="contact.asp">
                        <b>Envíenos un mensaje</b> <span></span>
                        <input type="text" name="fname" id="fname" value="Nombre">
                        <input type="text" name="email" id="email" value="Dirección de Email">
                        <select name="Consultorio">
                            <option>Elija Consultorio...</option>
                            <option>Queretaro</option>
                            <option>San Miguel</option>
                        </select>
                        <textarea name="message" id="message" cols="30" rows="10">Escriba aquí su mensaje...</textarea>
                        <input type="submit"  name="send" id="send" value="Enviar Mensaje">
                    </form>

how do i set a input name in the select in order to asp read the select option?
regards
SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ernesto

ASKER

i put it consultorio but mark me an error, here is the asp call

sql="INSERT INTO comentarios (nombre,email,producto"
sql=sql & "comentario)"
sql=sql & " VALUES "
sql=sql & "('" & Request.Form("fname") & "',"
sql=sql & "'" & Request.Form("email") & "',"
sql=sql & "'" & Request.Form("consultorio") & "',"
sql=sql & "'" & Request.Form("message") & "')"

on error resume next
conn.Execute sql,recaffected
if err<>0 then
  Response.Write("No update permissions!")
else
  Response.Write("<h3>" & recaffected & " Nos pondremos en contacto con usted cuanto antes</h3>")
end if
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
+  on line 6 above, use

Replace(Request.Form("message"),"'","''")

just in case message contains '
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ernesto

ASKER

Oh men , tnkx guys
Avatar of Ernesto

ASKER

Thank you experts
how is this an answer? all it is is your sql w/out any explanation......
Avatar of Ernesto

ASKER

im just put in my asp the huseyn syntax and works  just put up my second line into only one
sql=sql & "comentario)"
 regards
not trying to be a jerk here, but all that answer does is reformat the string. the actual cause of the problem was there were no values being passed to the page, because the VALUE attribute wasn't specified. it had nothing to do with the format of a variable....
not reformat, he forgot to add "," between "producto" and "comentario"
also, I combined those into one line to look nice :)

also, he forgot to add values to options in aspx