refer to images in other page

Posted on 2006-05-07
Last Modified: 2010-04-17
i am a php beginner and need to apply loops, arrays...
My task is:
i have one page category.php
the user selects from 4 categories of images he can see: travel, portrait, abstract, dance
when he clicks a radio button...he has to be taken to the next page catalog.php where in
each category he sees four images with the image description and the price. I do not know how to do that link.
my category.php looks like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

<meta name="author" content="Angelika Bertsch"/>
<meta name="description" content="angelika bertsch creative imagery photography"/>
<meta name="keywords" content="photography,black and white photography"/>
<meta name="last modified" content="april 19,2006"/>
<meta http-equiv="content-type"content="text/html;charset=ISO-8859-5"/>

<link href="abertsch.css" type="text/css" rel="stylesheet"/>


<div id="logo">
<p class="logo1">Angelika Bertsch </p>
<p class="logo2">       Creative Imagery</p>
<p class="logo3">    </p>

print date("D dS M,Y h:i a");
<form action = "category.php" method = "post">
<h1>I offer images within the following galleries</h1>
Please choose one of them:<br />

<input type = "radio" name = "category" value = "travel" checked/>travel<br />
<input type = "radio" name = "category" value = "portrait"/>portrait<br />
<input type = "radio" name = "category" value = "abstract"/>abstract<br />
<input type = "radio" name = "category" value = "dance"/>dance<br /><br />

<input type = "submit" text = "submit" value = "submit"/>
<input type = "reset" text = "reset" value = "reset"/><br /><br />

if (isset ($_POST['submit']))
choose a category
user input  categories = array("travel","music","abstract","dance")

if user choose pos1 show 3 travel images in catalog.php
if user choose pos2 show 3 music images
if user choose pos3 show 3 abstract images
if user choose pos4 show 3 dance images


Question by:angiweb10
    1 Comment
    LVL 49

    Accepted Solution


    Actually this shouldn't be to hard. You can use the switch-statement to test $_POST['category'] and output the correct images:

    if(isset($_POST['category']) { ///if (isset ($_POST['submit']))
      switch($_POST['category']) {
         case 'travel';
            echo '<img src="travel1.jpg" />';
            echo '<img src="travel2.jpg" />';
            echo '<img src="travel3.jpg" />';
         case 'music';
            echo '<img src="music1.jpg" />';
            echo '<img src="music2.jpg" />';
            echo '<img src="music3.jpg" />';
         case 'abstract';
            echo '<img src="abstract1.jpg" />';
            echo '<img src="abstract2.jpg" />';
            echo '<img src="abstract3.jpg" />';
         case 'dance';
            echo '<img src="dance1.jpg" />';
            echo '<img src="dance2.jpg" />';
            echo '<img src="dance3.jpg" />';


    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

    RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    730 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

    15 Experts available now in Live!

    Get 1:1 Help Now