Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4

Thread: URL parameter

  1. #1
    Junior Member
    Join Date
    Jun 2005
    Posts
    3
    Member #
    10159
    Hi All,

    I have this website that uses HTML selection boxes to allow the user to pick and view photos. I have the selection boxes hold the folder path and photo name, and then I got some PHP to display the image by concatenating the values of the selection boxes to create a src path, and then echo an HTML image tag.
    Right now when someone first opens a page no photo has been selected and therefore I have a dead img tag. I am thinking of using a URL parameter that will hold a default image to display. But my problem is that I have been searching and I can't find much info on creating and using URL parameters in PHP. Does anyone have any resources that could help me to use URL parameters and PHP?

    Many Thanx for helping in advance

  2.  

  3. #2
    Senior Member Stylise's Avatar
    Join Date
    Jul 2005
    Location
    Mount Martha, Australia
    Posts
    229
    Member #
    10679
    Can I see what you have so far? Just the php if need be.

  4. #3
    Junior Member
    Join Date
    Jun 2005
    Posts
    3
    Member #
    10159
    I actually solved it. I created a POST var and set it to a default path.

    This section of PHP is in its own .php file since i have many other pages calling it.
    Code:
    <?php
    /*set default img*/
    $image  = $_POST['defImg'];
    /*To display images that are seperated by Plans*/
    if (isset($_POST["graph"]) && isset($_POST["plan"])){	
    	$image='"'.$_POST['graph'].$_POST['plan'].'"';
    }
    /*If the graph is not seperated by plans, then we only need the graph var, which will hold the location of the image*/
    else if(isset($_POST["graph"])){
    	$image='"'.$_POST['graph'].'"';
    }
    echo '<img src='.$image.'>';
    ?>
    And in the page that calls this code i have
    Code:
    <?php $_POST['defImg']='"'."../images/PlanA.jpg".'"';?>
    I am new to php so it may be messy...but it gets the job done.

  5. #4
    Senior Member Stylise's Avatar
    Join Date
    Jul 2005
    Location
    Mount Martha, Australia
    Posts
    229
    Member #
    10679
    Ah cool, good to see you got it working.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:51 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com