Jump to content

How to link a url to this php?


11Tami

Recommended Posts

Hello, here is some code that if show is in a url and is equal to 1 then the following php text should appear. Problem is when I put in a url like this http://www.website.com/show=1.php nothing happens. When I use this http://www.website.com/page.php?show=1  It doesn't like that either, it says a question ? mark cannot be used in a url address. Please someone let me know the proper way to do this. To link a url to this code.....Thank you very much

 

<?php
$show = $_GET['show'];
if($show == 1){
   print 'text here';
}
?>

Link to comment
Share on other sites

Thanks, but I don't know what you mean. I need to know what to name the page? If I name it something like this....    code.php?show=1        I cannot upload it to my ftp account. It says it will not take the question mark in the url address. Should this be happening?

 

 

<?php

$show = $_GET['show'];

if($show == 1){

  print "text";

}

?>

 

 

Link to comment
Share on other sites

First off your URL sting needs to be:

 

http://www.website.com/page.php?show=1

 

Inside page.php you need to have the follwoing

 

<?php

$show = $_REQUEST['show'] ;

 

if ($show == 1) {

  print "Hello World";

}

if ($show == 2) {

print "Goodbye World";

}

?>

 

 

Now you should see that if you follow that URL to the page you have the code inside of.  If you are getting that error message means your Web Server is not configured correctly for PHP and that is the main problem.

Link to comment
Share on other sites

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.