Click here to Skip to main content
13,091,996 members (59,890 online)

How to get a vlaue of Dropdown and Input files ?

Rajeshkrathor asked:

Open original thread
I want to get value of dropdown list out side form tag.
Drop Down
<td width="225" align="left"><select id="month" name="month" >
<option selected="selected" value="">----Month----</option>
<option value="January">January</option>
<option value="February">February</option>
<option value="March">March </option>
<option value="April">April</option>
<option value="May">May</option>
<option value="June">June </option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September </option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December </option>
text fox.
<td width="80%" align="left"  ><input id="name" name="name" disabled="disabled" type="text" value="abc" style="width:200px;"/></td>

<form enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post"><td align="right"><label for="file1">Attache File</label> <input type="file" name="file" id="file"><input type="submit" Value="Send For Approval" id="mail" name="mail" /></td></tr></table></form>

I want to get value on the mail button click but unable to get any value content from out side form.

Here is my php code.

	 $month=$_GET['month'];// not by this
    $month=$_POST['month'];// not by this
	echo "<script>alert($month);</script>";

If any one of you have any idea then pls let me know.
Tags: PHP


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy |
Web04 | 2.8.170813.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100