Why is this php array not getting anything?
I'm trying to submit a 'defacto' option array (although it looks like a search bar) to a php file and show the results that I sent. This is what it looks like now:
Link to image: http://i.imgur.com/Ak4dk.pngAnd so what I did was that I changed the submit.php from this:
<?php print_r($_REQUEST); ?>
To this:
<?php
if(isset($_POST['$_REQUEST']))
{
$aVenues = $_POST['select3'];
if(!isset($aVenues))
{
echo("<p>You didn't select any venues!</p>\n");
}
else
{
$nVenues = count($aVenues);
echo("<p>You selected $nVenues venues: ");
for($i=0; $i < $nVenues; $i++)
{
echo($aVenues[$i] . " ");
}
echo("</p>");
}
}
?>
Here's a link to the page, and as you can see the submit.php shows an empty page, why is this :/ ? 开发者_如何学PythonThank youu :)
Try
if(isset($_POST['select3']))
Not what you have at the moment. That index won't exist in $_POST.
the if
if(isset($_POST['$_REQUEST']))
fails.
$_REQUEST and $_POST are both different arrays, 1 containing only POST data, the other combining POST and GET.
The check should be (I assume)
if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST)) { }
To verify that data actually has been posted to the server.
精彩评论