Solved

...

Posted on 2000-02-16
8
235 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
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

777 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