Jump to content

Recommended Posts

Hi Everybody,  :D

 

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 ?  :P

 

hopefully one of you will be able to help  ;)

 

thanks always  :-*

 

Truegilly  :D

Link to comment
https://forums.phpfreaks.com/topic/62945-adding-another-get-var-to-the-url-string/
Share on other sites

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  :D

 

truegilly

???

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';

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.