|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
conditional statement
i am new to php and have been using cold fusion. i need to find how to do the same thing in php that i have in cold fusion. here is the cold fusion code:
<cfparam name="action" type="numeric" default="1"> <cfif action is 1> enter text here </cfif> <a href="#path_info#?action=3"></a> <cfif action is 2> enter text here </cfif> <a href="#path_info#?action=3"></a> all this does is allow you to create different sections within each page so you don't have to create new pages to link to but you can just call up certain parts of the page. i found how to use the if, else, else if statements in php but i can't find a way to create a variable that it's value can change like this. What tag is there to use like the cfparam so i can create a new variable like that? thanks! |
|
#2
|
|||
|
|||
|
Well, here's a simple three layered script that displays different text based upon clicking one of the two links:
PHP Code:
So, all that's happening is you are embedding action into the URL and assigning it a value of 1 or 2. Based upon that, the script will display "Your action is 1" if $_GET['action'] is equal to 1, or "Your action is 2" if $_GET['action'] is equal to 2. You could use just $action instead of $_GET['action'] but it's highly recommended to use the $_REQUEST array with PHP now. Last edited by rheroux : March 18th, 2003 at 01:37 PM. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > conditional statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|