hustla Posted June 21, 2006 Share Posted June 21, 2006 OK guys at one point i hade this working but for the past 3 hours i can't get it to work anymore. What i want to do is simply have a form where the action url has variables that get stored in the $_GET global but the form data in the $_POST. for example <form action="?MyAds&CurrentPage=CreateAd" method="post" enctype="multipart/form-data">i want to access CurrentPage and MyAds in the $_GET but on sumbit the $_GET is not being set its null and i have no idea why please help me out here im using php5. The post data on the form is indeed being saved which is how i want it but im using the $_GET for site navagation. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/12582-_get-and-_post-at-same-time/ Share on other sites More sharing options...
Wildbug Posted June 21, 2006 Share Posted June 21, 2006 I'm not sure how PHP deals with those GET variables in a POST action form, but I can suggest a slightly different approach.If you put your extra GET variables into the form using "hidden" inputs:[code]<input type="hidden" name="CurrentPage" value="CreateAd">[/code]Then you can use PHP's superglobal, $_REQUEST, to check for those variables regardless of whether they've been set via GET or POST.[code]I.e., if ($_REQUEST['CurrentPage'] == 'CreateAd') ....; // etc[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12582-_get-and-_post-at-same-time/#findComment-48219 Share on other sites More sharing options...
cmgmyr Posted June 21, 2006 Share Posted June 21, 2006 I would just add the variables as hidden inputs (as above) then you can do whatever you want with them. Quote Link to comment https://forums.phpfreaks.com/topic/12582-_get-and-_post-at-same-time/#findComment-48222 Share on other sites More sharing options...
hustla Posted June 21, 2006 Author Share Posted June 21, 2006 Yea i considered that but its killing me why this is not working i tyed the same method on a different page and it worked. let me know if you guys come up with any other ideas i might have to use your suggestion. Quote Link to comment https://forums.phpfreaks.com/topic/12582-_get-and-_post-at-same-time/#findComment-48223 Share on other sites More sharing options...
kenrbnsn Posted June 21, 2006 Share Posted June 21, 2006 GET & POST work fine together, you just have to remember to use $_GET for the ones on the URL and $_POST for the others.Ken Quote Link to comment https://forums.phpfreaks.com/topic/12582-_get-and-_post-at-same-time/#findComment-48224 Share on other sites More sharing options...
hustla Posted June 21, 2006 Author Share Posted June 21, 2006 ok i think i might know what the problem is. I have two forms inside the page how do i map the button to the appriate form actionok i finnaly solved the problem ... this site im making is getting big so im seperating each part of the web page and incudeing them based on parameters. What was casusing the problem was that i had a form inside another form therefore on a submit it took the first forms action instead of the secounds action url. Thanks guys im so glad this damn problem is over it was killing me. Quote Link to comment https://forums.phpfreaks.com/topic/12582-_get-and-_post-at-same-time/#findComment-48226 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.