简体   繁体   中英

$_POST for dropdown returns null on web-server

This looks pretty odd that $_POST for a value of a dropdown returns null while on the webserver but works perfectly fine on my local machine.

I was working on form and it happens to post itself to another where the data in the input fields are added or updated in the database.

//------My Form-----------
<form action="addNewWorksheet.php" method="post"  enctype="multipart/form-data">
Title: <input type="text" id="txtTitle" name="txtTitle"/>
Class: <select id="ddlClass" name="ddlClass">
<option value="S">Select</option>
<option value="PS">Pre-School</option>
<option value="PP">Pre-Primary</option>
</select>
</form>

//----addNewWorksheet.php----------
$WTitle = $_POST["txtTitle"]; 
$WClass = $_POST["ddlClass"];

but here $_POST["ddlClass"] returns null as I checked it with

 if(!isset($_POST["ddlClass"])) exit;

and it simply exits but does not executes the program further. The thing that is again strange is that the txtTitle returns value perfectly but ddlClass does not. And again it works perfect on my local system (wamp), but not on the web-server.


Further Information:

The values are being perfectly posted, as seen on firebug, but gets nullified somewhere.

It sounds like a problem with your PHP configuration.

Use php_info() or phpinfo() , depending on the PHP version you use, on your local machine and on the webserver, compare the results. Especially the sections about variables should be interesting for you. Then, when you found the differences, adjust the php.ini on your server, to match the local settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM