Solved

...

Posted on 2000-02-16
8
246 Views
Last Modified: 2006-11-17
Here goes my last 50 points... Just cause I'm too lazy to look in a book for the answer...
OK I'm trying to learn how to use PHP. I can use Cold Fusion fairly well but that's not all that much like PHP.
My question is...
In Cold Fusion you can call on a variable in the 'location' in the browser... for example
index.cfm?thread_ID=4444
where the variable thread_ID is 4444.
so is it possible to do this in php?
ex index.php3?thread_ID=4444
I need this so that when a user clicks on a thread in my forums they can click on the url ?thread_ID=???.
So I know this is possible.. Could you please give me the code to call it from the URL...

thank ya...

- Mike Page
www.idev.org
webmaster@supercool.org
ICQ: 829645
0
Comment
Question by:SuperCool
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 2

Accepted Solution

by:
gravity earned 50 total points
ID: 2529594
Yep, that's how you set variables.

For example :

<A HREF=mypage.php3?variable=test&variable2=anothertest>Click here!</A>

Will go to mypage.php3 and set $variable to 'test' and $variable2 to 'anothertest'.

0
 

Author Comment

by:SuperCool
ID: 2529679
ya.. that i could have figured out myself...
but i need to know how to access those variables from my page....
for example i want it to...
select * where thread_id = #URL.Thread_ID#

(#URL.Thread_ID# the equivelant as a CF tag)

- Mike
0
 
LVL 2

Expert Comment

by:gravity
ID: 2529712
Is the following what you're after ?

<?
    $sql = "select * from table where thread_id='$thread_id'";
?>

where $thread id is the value passed by the URL ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:SuperCool
ID: 2529760
so simple? sounds good to me...
0
 
LVL 2

Expert Comment

by:freshmeat
ID: 2529955
yes!
that is why php cooler than asp!
simpler is better!!
:)
i like php!!
^@^
0
 

Expert Comment

by:tejass
ID: 2530867
It is much simpler than that. You just use the variable $thread_ID in the page that is being called.
0
 

Author Comment

by:SuperCool
ID: 2530882
question was already answered
0
 
LVL 2

Expert Comment

by:gravity
ID: 2531676
Groovyness is PHP indeed... one other shortcut you might find usefull :
You know the start and end PHP tags, ie <? and ?> ?
Well, you can use them really usefully to separate HTML in if statements, e.g. :

<?
    if (statement) {
?>
<SOME HTML>
<?
    } else {
?>
<SOME OTHER HTML>
<?
    }
?>
This quite usefull as it means you don't have to format the HTML you want to output using echo or whatever.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question