truegilly Posted August 1, 2007 Share Posted August 1, 2007 Hi Everybody, i was wondering if anyone could help me ?? ??? i have a form that validates using GET, what i would like to do is add an additional variable to the get string. i have tried various suggestions like.... 1. concatenating the GET variable on the end of the action="..." string. 2. I have tried to add the value on the end of the $_GET array using array_push(). 3. I tried to add the variable to the $_SERVER['QUERY_STRING'] variable. At the bottom of my page i am outputting the $_GET array to see when the extra value is outputted, but I only get a result when i physically type the "&Email=fail" on the end of the URL. I suppose i could get round this by using hidden form fields but there must be an easier and more efficient way of simply adding another get var to the end of the URL string ? hopefully one of you will be able to help thanks always Truegilly Quote Link to comment https://forums.phpfreaks.com/topic/62945-adding-another-get-var-to-the-url-string/ Share on other sites More sharing options...
teng84 Posted August 1, 2007 Share Posted August 1, 2007 can you give us your sample code hmm!! BTW have you do this test.php?x=y&v=v or what do you really want Quote Link to comment https://forums.phpfreaks.com/topic/62945-adding-another-get-var-to-the-url-string/#findComment-313422 Share on other sites More sharing options...
truegilly Posted August 1, 2007 Author Share Posted August 1, 2007 ok heres some of my code.... <form action="<?php $_SERVER['PHP_SELF']; echo $emailGet;?>" method="GET" if(!check_email_address($email)) { echo "invalid e-mail address"; $emailGet = "&emailValidation=fail"; } else { $emailGet = "&emailValidation=ok"; } basically once the emailValidation var is in the URL im going to pick this up later in the code to alert the user that their email address was not valid. i have also tried this.... $getstring = '?'; foreach ($_GET as $key=>$get) { $getstring .= $key . '=' . $get . '&'; } then trying to add it on the end of the $_GET array. thanks truegilly Quote Link to comment https://forums.phpfreaks.com/topic/62945-adding-another-get-var-to-the-url-string/#findComment-313446 Share on other sites More sharing options...
teng84 Posted August 1, 2007 Share Posted August 1, 2007 ??? but maybe you would want to do this <?php echo $_SERVER['PHP_SELF'].'?'.$emailGet;?> and this $emailGet = "&emailValidation=fail"; to $emailGet = "?emailValidation=fail"; coz base in your code its the 1st query string you have and i dont understand what you want in your second code maybe this will work $_GET['x'].='add value'; Quote Link to comment https://forums.phpfreaks.com/topic/62945-adding-another-get-var-to-the-url-string/#findComment-313461 Share on other sites More sharing options...
truegilly Posted August 2, 2007 Author Share Posted August 2, 2007 thanks for your suggesstion, ill have a go when i get back from work Truegilly Quote Link to comment https://forums.phpfreaks.com/topic/62945-adding-another-get-var-to-the-url-string/#findComment-313761 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.