mynameisbob Posted May 5, 2009 Share Posted May 5, 2009 what is the equivelant to php 4s <form method=post action=file.php?action=1234> <input type=submit value=Clear name=clear> </form> <?php if($action == 1234) { print"hi"; } ?> and the website would be something like www.xxx.com/file.php?action=1234 that wouldnt work in php 5 but it does in php 4. I know in php 5 it would be something using $_POST or $_GET but im not to keen these. Quote Link to comment https://forums.phpfreaks.com/topic/156981-form-submitting/ Share on other sites More sharing options...
Maq Posted May 5, 2009 Share Posted May 5, 2009 Try this, should be pretty self explanatory, but if you have questions please ask: </pre> <form method="GET" action="file.php?action=1234"> </form> <br><br><br>if($_GET['$action'] == 1234)<br>{<br> print"hi";<br>}<br Quote Link to comment https://forums.phpfreaks.com/topic/156981-form-submitting/#findComment-826915 Share on other sites More sharing options...
Ken2k7 Posted May 5, 2009 Share Posted May 5, 2009 Wouldn't it just be simpler to type the action in the URL rather than that form? Quote Link to comment https://forums.phpfreaks.com/topic/156981-form-submitting/#findComment-826920 Share on other sites More sharing options...
suncore Posted May 5, 2009 Share Posted May 5, 2009 Form method POST and you want to get something via GET method ? Why ? If you want to get something from URL, use GET - if you want to get something from somewhere ( buffer ), use POST. As simple as that Quote Link to comment https://forums.phpfreaks.com/topic/156981-form-submitting/#findComment-826921 Share on other sites More sharing options...
Maq Posted May 5, 2009 Share Posted May 5, 2009 Wouldn't it just be simpler to type the action in the URL rather than that form? Guess we won't know until he elaborates on his application first. Quote Link to comment https://forums.phpfreaks.com/topic/156981-form-submitting/#findComment-826929 Share on other sites More sharing options...
mynameisbob Posted May 5, 2009 Author Share Posted May 5, 2009 ok, i mean in php 4 you could use say there was a form at the link www.xxx.com/link.php and it brought you to that same page but with ?action=1234 that said name: "bob" as what you typed in and the name was "name" if ($action == 1234) { print"$name"; exit; } and on the website it would say bob but in php 5 it doesnt work Quote Link to comment https://forums.phpfreaks.com/topic/156981-form-submitting/#findComment-826935 Share on other sites More sharing options...
suncore Posted May 5, 2009 Share Posted May 5, 2009 PHP4 is history Anyways, problem solved ? Quote Link to comment https://forums.phpfreaks.com/topic/156981-form-submitting/#findComment-826936 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.