• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

Form Submit problem ...

Hi, please review this form below:
<form enctype="multipart/form-data" name="form" method="post" action="">
Your Name: <input type="text" name="name" size="40">
<br />
Your Computer OS: <select name="os">
<option value="">-- Choose One --</option>
<option value="windows">Windows</option>
<option value="linux">Linux</option>
<option value="other1">Other</option>
</select>
<br />
<label>Please specify: <input type="text" name="other2" class="DEPENDS ON os BEING other1"></label>
</form>

actually there's NO problem on the submit form above .. it is done through JavaScript, so if user choose Other (value="other1") on the selectbox then an additional text input is shown (name="other2").

Problem is on the PHP where I want it submit only the value of 'other2' if user selected Other (value="other1") on the selectbox ... Please modify this PHP codes below:

if (isset($_REQUEST['name']))
  $name = $_REQUEST['name'];

if (isset($_REQUEST['os']))
  $os = $_REQUEST['os'];

$msg = "Name: $name\nComputer OS: $os\n";

@mail($recipient, $subject, $msg, $headers);
0
planetemails
Asked:
planetemails
  • 2
1 Solution
 
hernst42Commented:
Try:


if (isset($_REQUEST['os'])) {
   if ($_REQUEST['os'] == 'other1') {
     $os = $_REQUEST['other2'];
   }else {
     $os = $_REQUEST['os'];
   }
}
0
 
planetemailsAuthor Commented:
Cool, man ... The point is yours ...

By the way, can you also help me in this (let me know if you want me to open a new issue) .. actually the form is having an image verification (captcha), and if the image verification is wrong then user is redirected back to the same form showing the information that they were filled previously ... I put this on that page:

if (isset($_REQUEST['name']))
  $name = $_REQUEST['name'];

if (isset($_REQUEST['os']))
  $os = $_REQUEST['os'];

And the value of $name is written on the <input type="text" name="name" value="$name" size="40"> ... BUT not on the selectbox which is:
<select name="os" value="$os">
<option value="">-- Choose One --</option>
<option value="windows">Windows</option>
<option value="linux">Linux</option>
<option value="other1">Other</option>
</select>

Please guide me on this ... (OR let me know if you want me to open a new issue for this) as I need an a.s.a.p answer ...
0
 
planetemailsAuthor Commented:
Okay okay ...
I know it's too much .. :(

Please have a look at the NEW issue here ...

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_22756043.html

Thanks anyway ...
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now