Jump to content

Appending query strings


Drongo_III

Recommended Posts

Hi Guys

 

Again, another noob question that I can't seem to find a concise answer to.

 

What is the best way to append a query string to a url?

 

I've tried using the Header() function but this didn't seem to work - i.e.

 

 Header("Location: enc.php?ID=test");

 

My goal is to change the query string depending on the output of various if else statements. For instance if $test isset then execute some code.

 

The script will be self contained so it'll be posting back to itself with the query string and reacting differently depending on the query string.

 

Any ideas?

 

PS sorry if i am asking too many questions. Eager to learn and struggling to find answers to some things.

 

What I basically want to do (and not sure if this is possible) is to append a different query string based on

Link to comment
https://forums.phpfreaks.com/topic/235303-appending-query-strings/
Share on other sites

What do you mean you cant append a query string with Header, is this what you mean?

<?php

if(isset($_GET['hello'])){

$name = $_GET['hello'];

echo "Hello ".$name."";

}

else{

header("Location: http://www.rasclerhys.com/test6.php?hello=Rhys");

}

?>

 

Hope this helps :)

Well that seems to work now. I can't work out what was going wrong but I kept getting a message saying it couldn't load the page "because the requested action will never complete". This was a browser generated message.

 

Anyway retried it and it's working fine with header now. I think i'd been staring at the screen too long!

 

Thanks for help chaps!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.