Solved

...

Posted on 2000-02-16
8
231 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
 

Author Comment

by:SuperCool
ID: 2529760
so simple? sounds good to me...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now