How do I pass values from a URL into my site ?

Hi,

Im attempting to create a website that needs to change a few details within the HTML depending on the URL, for example...

www.somedomain.com/index.html?XS-100?200?100?19.95 etc

Then how do I get the code on the website to show these figures how I choose on the site

Regards
MirageSFAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JonzaCommented:
i'm not sure that you can do that with only HTML.
but i'm 100% sure that is possible with PHP :)
0
IeuanJCommented:
You would need to use some form of scripting language to add dynamic content, ASP or PHP are prime candidates.  The below is an example of how this can be done with ASP/VBScript and the URL of "index.html?test=IeuanJ" where IeuanJ is an example of a username.

...  
<% If request.querystring("test")="IeuanJ" Then %>
   ...  'add Ieuanj content  ...
<% If request.querystring("test")="Wally" Then %>
   ...  'add Wally content  ...
<% If request.querystring("test")="Jane" Then %>
   ...  'add Jane content  ...
<% If request.querystring("test")="Jurgen" Then %>
   ...  'add Jurgen content  ...
<% Else %>
   ...  'add no-one content  ...
<% End If %>
...  
0
JonzaCommented:
with php
<?php
  if(isset($variable)){
    print("the content you want printed when the url has ?variable=something");
  }
?>
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

IeuanJCommented:
Cheers Jonza, not got into PHP yet, darn workplace wants to stick with ASP - VB - Visual, in fact its an MS Hell :(
0
MirageSFAuthor Commented:
Cool Jonza that works ok, but I really need to be able to address a single variable in the html, basically www.test.com/index.php?ds=200dt=2.5price=$4.95 etc, so how at the chosen location can I put say <?php print ("ds") ?> and it just shows the value for that variable ?

Regards
0
JonzaCommented:
no quite.
if you put variable to url like this index.php?ds=something
you can print it like this
<?php print($ds); ?>  <-- prints "something"
remember the $ because it has to be in front of every variable in php.
0
MirageSFAuthor Commented:
Perfect, one last thing before I end this question, is it possible to get the print(ds) etc when its inserted into the html, for this to take on the size, type etc of the font in use ?  As where some of these variables need to go the text is quite large, but when the variable is printed it goes in small!

Regards
0
JonzaCommented:
yes it is!

www.somedomain.com/index.php?fontsize=3
<font size="<?php print($fontsize); ?>">Some text</font>
0
JonzaCommented:
you can also check that if some variable exists like this:
<?php
if(isset($fontsize)){
   print("<font size='$fontsize'>sometext</font>");
}
else{
   print("<font size='1'>sometext</font>
}
?>

if fontsize is set it prints the text with that size and if not it uses default size 1 =)
0
MirageSFAuthor Commented:
What have I done wrong here ?  Trying to get it if value EA=999 then print unlimited else print the value of ea

if(isset($ea=999)){
  print("Unlimited");
}
else{
  print($ea
}
0
JonzaCommented:
no it doesn't work like that
if you want to compare the variable do it like this
if($ea == 999){
}

0
JonzaCommented:
if(isset($ea)){
    print("there is variable ea<br>");
    if($ea == 999){
        print("YES ea = 999");
    }
    else{
        print("No ea is $ea");
    }
}
else{
    print("variable ea is not set");
}

that should help you understand the difference =)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MirageSFAuthor Commented:
God damn its C ! lol, about time I got some sleep me thinx :)  Thanx for your help Jonza, and your blinkin' fast !

Best Regards

Wayne
0
JonzaCommented:
no problem
glad i could help
0
MirageSFAuthor Commented:
Sorry to bother u again, but how do I clear the URL bar from http://www.test.com/index.php?v1=1&v2=3 etc so the bar just shows http://www.test.com

Thanx
0
JonzaCommented:
you cant modify it with any script but if you redirect to some other url that will ofcourse change.

php redirect

header("Location http://test.com");
//headers must be before any other output
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.