PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hey , this is probably n00bish but I've got a question: I have a very simple webpage with only a submit button on it. In the code, I have a little PHP script to check if the submit button variable is set. Theoratically, when you go on the page for the first time, the script says that the variable isn't set. When you press the submit button, the page would reload and the script would say that the variable is set because the value of the button would have been passed as a $_POST. Now, in a browser everything works fine. But if you try to give a value to the submit button through a URL the script still says the variable isn't set. Anyway here is the code:
If you click the button, the page reloads and it displays "hurra!", but if you try accessing the page by writing "http://membres.lycos.fr/xxthesilent1xx/ ... o=whatever" the script says the variable isn't set. Can anyone tell my how to "activate" the variable by typing in a special URL??
No... $_POST variables is set when the variables is posted.. Can't explain... But for instance when a script is called from a form with method="post".... $_GET is variables typed after ? in the URL...
but you can do
$_POST['jo']=$_GET['jo'];
and maybe, do some checking
if(isset($_GET['jo'])) {
// jo was typed in URL
} elseif(isset($_POST['jo'])) {
// jo was POST'ed
} else {
// Neither $_GET['jo'] nor $_POST['jo'] was specified
}
Yes, but it involves rather complicated header-ish type calls. I haven't done it in years.... If you read the HTTP specs you can probably find the necessary calls. Or try using the CURL library.
thesilent1 wrote:Hey , this is probably n00bish but I've got a question: I have a very simple webpage with only a submit button on it. In the code, I have a little PHP script to check if the submit button variable is set. Theoratically, when you go on the page for the first time, the script says that the variable isn't set. When you press the submit button, the page would reload and the script would say that the variable is set because the value of the button would have been passed as a $_POST. Now, in a browser everything works fine. But if you try to give a value to the submit button through a URL the script still says the variable isn't set. Anyway here is the code:
If you click the button, the page reloads and it displays "hurra!", but if you try accessing the page by writing "http://membres.lycos.fr/xxthesilent1xx/ ... o=whatever" the script says the variable isn't set. Can anyone tell my how to "activate" the variable by typing in a special URL??
the easiest way is what i did to the script.
anything else requires your user to know more about html than most non-hackers do