Jump to content

if/then/else?


rnewman

Recommended Posts

Trying to make new web page when user ticks off a one choice of 6 options

then page adds picture of choice to a master display (of pictures) of all choices (and scales down as list gets bigger)

also a text list of options already selected is also displayed.

I don't think I need a data base because I only have 6 choices but some show up in list more than one time.

I think I can do it with if/then/else but not sure.

 

I like php and can get what I need for simple examples.

 

Thanks,

Ray

 

Link to comment
Share on other sites

<?php
if ($x == 1) {
   echo 'here';
}elseif ($x == 2) {
   echo 'there';
}// ... etc
?>

 

<?php

switch ($x) {
    case '1':
         echo 'here';
    break;
    case '2':
         echo 'there';
    break;
}
?>

 

 

Link to comment
Share on other sites

I found this:

 

<?php

$theuri = $_SERVER['REQUEST_URI'];

if ( ($theuri =="/") or ($theuri =="/index.php") )

{

$itemis = "<img src=\"images/arrow.gif\" alt=\"arrow \">

<span class=\"note\"> Screen Text Here </span>";

} else {

$itemis = "<a href=\"www.yourdomain.com/index.php\">Screen Text Here </a>";

}

echo $itemis;

?>

 

which seems more useful to me but I forgot how to do selection and regenerate page.

Thanks,

Ray

 

Link to comment
Share on other sites

I may have missed the point, but if you are just using static data(ie, you wont be retrieving any data from a database after the selection of a checkbox) then you might as well just use javascript to do this. If you will be quering the database based on a selection and want to change a part of your page based on the result, use AJAX.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.