Solved

...

Posted on 2000-02-16
8
228 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

758 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

19 Experts available now in Live!

Get 1:1 Help Now