sdpullen Posted January 19, 2007 Share Posted January 19, 2007 How would I insert the following script into a web page in a certain area? I have my page set up on tables and want the image on the left side of the page inside a table. Look here: http://www.sikestonfirstmedia.org/testpage.htmI turned the borders on so that you can see where things should be.Here is the script:[code]<?php$Sigs=array('http://www.sikestonfirstmedia.org/jocks/wknd.gif','http://www.sikestonfirstmedia.org/jocks/dj1.gif','http://www.sikestonfirstmedia.org/jocks/dj2.gif','http://www.sikestonfirstmedia.org/jocks/dj3.gif','http://www.sikestonfirstmedia.org/jocks/dj4.gif','http://www.sikestonfirstmedia.org/jocks/dj5.gif');$times = array(0,5,9,14,19,24);$time = date('H');$day = date('D');$w_days = array('Sun','Sat');if (in_array($day,$w_days)) $i=0;else { $i = 0; while ($time >= $times[$i]) $i++;}echo '<img src="',$Sigs[$i],'" >';?>[/code]Thanks for your help Quote Link to comment Share on other sites More sharing options...
RonnyZenn Posted January 19, 2007 Share Posted January 19, 2007 see this line[code]echo '<img src="',$Sigs[$i],'" >';[/code]I took it from your code, better if you change it in that way,[code]echo '<img src=\"'.$Sigs[$i].'\" >';[/code]i think then it should work ok. Quote Link to comment Share on other sites More sharing options...
obsidian Posted January 19, 2007 Share Posted January 19, 2007 [quote author=RonnyZenn link=topic=123126.msg508543#msg508543 date=1169213909]see this line[code]echo '<img src="',$Sigs[$i],'" >';[/code]I took it from your code, better if you change it in that way,[code]echo '<img src=\"'.$Sigs[$i].'\" >';[/code]i think then it should work ok.[/quote]Actually, the original syntax is perfect. There is no need to escape double quotes when you're within single quotes, and the comma is often the preferred concatonation device. Where your error apparently lies is that you are including PHP script within an HTM page. You have to do one of two things to get it to work:1. Save the page as .php so your server knows how to interpret it2. Modify your PHP install to recognize and parse .htm files as PHPGood luck! Quote Link to comment Share on other sites More sharing options...
sdpullen Posted January 19, 2007 Author Share Posted January 19, 2007 Thanks guys, I saved it as a .php file and it works great now. Thanks again!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.