Radio buttons to pass through email

the mail() function

Moderators: macek, egami, gesf

mariopw
New php-forum User
New php-forum User
Posts: 5
Joined: Sat Jan 08, 2005 8:33 am
Location: Arizona, U.S.A.

Radio buttons to pass through email

Postby mariopw » Sat Jan 08, 2005 4:24 pm

Help: when I send A16_mode in the $body of an email
mail($to, $subject, $body, $headers); The variable A16_mode is blank.
I know A16_mode has three conditions, but I am assuming that depending which is selected it would assign a value. Anybody has any ideas that can help me?

Thank you very much.


Code: Select all

<B>Which Mode do you wish to use?</B><BR>
<UL>
  <DD><INPUT TYPE="radio" NAME="A16_mode" VALUE="<?php if (isset($_POST['A16_mode'])) echo 'Car'; ?>" checked>Car<BR>
  <DD><INPUT TYPE="radio" NAME="A16_mode" VALUE="<?php if (isset($_POST['A16_mode'])) echo 'Train'; ?>">Train<BR>
 <DD><INPUT TYPE="radio" NAME="A16_mode" VALUE="<?php if (isset($_POST['A16_mode'])) echo 'Motocycle'; ?>">Motocycle<BR>
</UL>
:help:

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sun Jan 09, 2005 2:36 am

You will need to post a A16_mode variable before its possible to use it... if the form has not been posted before -- it will be blank... the solution is Javascript...

mariopw
New php-forum User
New php-forum User
Posts: 5
Joined: Sat Jan 08, 2005 8:33 am
Location: Arizona, U.S.A.

Reply to Alexis

Postby mariopw » Sun Jan 09, 2005 8:54 am

Hello Alexis,

You said the solution is Javascript. Do you mean I should program the whole thing in Javascript and avoid PHP. Could you be more specific? I have the Javasript book from Tom Negrino - Visual Quickstart Guide, and that is what I am using to learn Javasript. How can the form be posted before, please explain.

Best regards,
Mario :shock:

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Sun Jan 09, 2005 9:21 am

No no no! Not avoid PHP... just use some JS here... but however im not getting what is it with if (isset($_POST['A16_mode'])) echo 'Car'
It will never be set in case A16_mode hasn't been posted to that page through a form with a POST method..


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest