Jump to content

URL adone


Recommended Posts

How do get something that like when you click say a link that takes you to test.php and will say HI on the page. But Iv seen stuff on sites where you go to a link to that test.php exept its test.php?test and the page would say HI HOW ARE YOU insted of HI... How do you do that?

Link to comment
Share on other sites

  • 1 month later...
How do get something that like when you click say a link that takes you to test.php and will say HI on the page.  But Iv seen stuff on sites where you go to a link to that test.php exept its test.php?test and the page would say HI HOW ARE YOU insted of HI... How do you do that?

203759[/snapback]

 

 

<?
if(!$test){
echo 'hi';
}
if($test == php){
echo 'welcome to PHP!';
}
?>

Hope that helped

Link to comment
Share on other sites

<?
if(!$test){
echo 'hi';
}
if($test == php){
echo 'welcome to PHP!';
}
?>

 

Yes this won't as you haven't defined any _POST or _GET variables. Or your PHP configuartion has register_globals on.

 

<?php
if(isset($_GET['test']) == "hi")
{
   echo "hi, how are your?";
}
else
{
   echo '<a href="'.$_SERVER['PHP_SELF'].'?test=hi">Click to see a message</a>';
}
?>

Link to comment
Share on other sites

I have got it figured out but now I am wondering how do you get it so that in your browser it will be something like calendar.php?cal=2005&month=feb I can get it to do that except if I have echo on the variable cal=2005 then it will show up when I put the cal=2005&month=feb plus the text that I want to echo back when you type that it so how can I get it so that cal=2005 will echo back as say calender and cal=2005&month=feb will just echo back with other next nothing that is on the cal=2005

 

here is my script

[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]

if( !$cal )

{

    echo \"Calender\";

}

if( $cal == 2005 )

{

    echo \"Choose a month\";

}

if( $cal == \'2005\' && $month == \'jan\' )

{

    echo \"January\";

}

[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

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.