GET['variable']) not working?
This function is not working for me. I think it is isset($_GET['success']) that's not working but I'm really not sure. the problem is it doesn't print anything ever. And without if(isset($_GET['success'])) it only prints "username taken" Please help?
<?php
if(isset($_GET['success'])) {
$success=$_GET['success'];
if($success=='yes') {
echo "<center><font color='red'>Comment Posted!</font></center>";
}
else {
echo "<center><font color='red'>Username taken!</font></center>";
}
}
?>
What kind of output are you getting from this? Are you passing the GET method correctly? the URL should have page_name.php?success=yes in it. If you're not getting anything and you want success to be only set if it is true perhaps this would be better.
<?php
if(isset($_GET['success']) && $_GET['success']=='yes')
{
echo "<center><font color='red'>Comment Posted!</font></center>";
}
else
{
echo "<center><font color='red'>Username taken!</font></center>";
}
?>
链接地址: http://www.djcxy.com/p/58888.html
上一篇: PHP的=&运营商