problem with HTML & PHP please help me

Discussion in 'PHP' started by varaprasadreddy, Apr 23, 2009.

  1. varaprasadreddy

    varaprasadreddy New Member

    Joined:
    Mar 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Dear friends/moderators

    I am developing a page. In that page at some location one image will be displayed. The image will change according to date & month. For changing the image i am using php script. The problem is, i am unable to integrate the file location in the html file.

    php code:
    -------------------------------------------------------------------------------------------
    <?php

    $holidays = array(
    '01-01' => 'newyear',
    '02-14' => 'valentines',
    '03-17' => 'saintpatricks',
    '04-12' => 'easter',
    '12-25' => 'christmas',
    );

    $date = date('m-d');

    if (isset($holidays[$date])) {$logo = 'holidays/logo_' . $holidays[$date] . '.gif';}
    else {$logo = 'holidays/logo_default.gif';}

    echo '<img src="' . $logo . '">';
    ?>
    -----------------------------------------------------------------------------------------
    I saved this code holidays.php
    I want to integrate the path of the php in the below code at

    <IMG SRC="holidays/IMAG003.JPG" WIDTH=533 HEIGHT=335 BORDER=0>

    in the above line already another image is there it was in red color & it should be changed with another image as in the php code.
    I inserted like this but not working

    <IMG SRC="holidays.php" WIDTH=533 HEIGHT=335 BORDER=0>



    html code in my page
    ---------------------------------------------------------------------------------------
    <DIV ID="SGROBJ7D9431612262221" STYLE=" position:absolute; top:160px; left:232px; width:533px; height:335px; z-index:3;">
    <IMG SRC="images/IMAG003.JPG" WIDTH=533 HEIGHT=335 BORDER=0>
    </DIV>
    -----------------------------------------------------------------------------------------
    I n the above html code how to change for working the php code.

    please help me. I had this trouble since one week.
    waiting for your replies
    thanks in advance.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Re: problam with HTML & PHP please help me

    Does your holidays.php output image url as

    echo '<img src="' . $logo . '">';

    But you expect only the $logo url and so you should see that logic
     
  3. varaprasadreddy

    varaprasadreddy New Member

    Joined:
    Mar 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Re: problam with HTML & PHP please help me

    Sir this is working for me in php when i executed but i was unable to use in html for changing the image.
    Sorry sir i dont know php & i am new to this please help me.
    waiting for ur reply.
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    When you use the following code

    <IMG SRC="holidays.php" WIDTH=533 HEIGHT=335 BORDER=0>

    The output becomes

    <IMG SRC="<img src="holidays/logo_default.gif">" WIDTH=533 HEIGHT=335 BORDER=0>

    I hope this helps and you understand what is wrong
     
  5. varaprasadreddy

    varaprasadreddy New Member

    Joined:
    Mar 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    sir it is not working, my be i didn't explained properly for you.
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    So then try to explain because its difficult to read your mind.
     
  7. varaprasadreddy

    varaprasadreddy New Member

    Joined:
    Mar 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    <?php

    $holidays = array(
    '01-01' => 'newyear',
    '02-14' => 'valentines',
    '03-17' => 'saintpatricks',
    '04-12' => 'easter',
    '12-25' => 'christmas',
    );

    $date = date('m-d');

    if (isset($holidays[$date])) {$logo = 'holidays/logo_' . $holidays[$date] . '.gif';}
    else {$logo = 'holidays/logo_default.gif';}

    echo '<img src="' . $logo . '">';
    ?>


    Sir the above code is executing in php. So i want to execute through the html page i.e.
    take a new html page named as some xxxxx if i open that page the above program should be executed
    at certain position in the page like top=100, left/right= 200 (x,y axis) with a particular size of the image because all the images will not be in the same size.
     
  8. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Just including the file should do it.
     
  9. varaprasadreddy

    varaprasadreddy New Member

    Joined:
    Mar 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    sir i dont how how to include the file please help me how tot include the file in html with in the body.
    aiting for ur reply.
     
  10. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    inlcude('path/to/file')
     
  11. varaprasadreddy

    varaprasadreddy New Member

    Joined:
    Mar 19, 2009
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice