SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2003
    Location
    pennsylvania
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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. #2
    SitePoint Enthusiast Traduim's Avatar
    Join Date
    Feb 2003
    Location
    Catalonia
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    More or less...

    PHP Code:
    <?
    if (!isset($action)) {$action 1;}
    if (
    $action == 1){echo "enter text here";}
    echo 
    "<a href=\"$path_info?action=3\></a>";
    if (
    $action == 2){echo "enter text here";}
    echo 
    "<a href=\"$path_info?action=3\></a>";
    ?>
    Josep Tarrés,
    traducción
    traductor


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •