Embedding PHP scripts
Posted by: Dan Gillgrass (---.range81-157.btcentralplus.com)
Date: August 11, 2006 12:21PM

Hiya,

Ive been wanting to code some PHP scripts for my web site but realised I couldnt do it on my local machine so a friend put me onto WAMP. But, im still having problems...

I coded this, embedding it into a html file...

<?php
$c=0;
$c++; $pic[$c]="url1.jpg";
$c++; $pic[$c]="url2.jpg";
$c++; $pic[$c]="url3.jpg";

srand ((double)microtime()*1000000);
$randval = rand(1,$c);
echo"<img src=\"".$pic[$randval]."\" alt=''>";
?>

put all I get for output is.....

" ;?>

Any ideas? have I not configured my machine right? I told WAMP to look into the correct directory for localhost but it still doesnt seem to recognise the PHP. Any help very appreciated...

DAN


Options: ReplyQuote
Re: Embedding PHP scripts
Posted by: dval (---.chrcitadelle.be)
Date: August 11, 2006 05:04PM

it is ok for me on wamp, it display picture randomly.
the code source in the resultpage is :
<img src="url2.jpg" alt=''>

the code source of the test page is (directly in php, not html ) :

<?php
$c=0;
$c++; $pic[$c]="url1.jpg";
$c++; $pic[$c]="url2.jpg";
$c++; $pic[$c]="url3.jpg";

srand ((double)microtime()*1000000);
$randval = rand(1,$c);
echo"<img src=\"".$pic[$randval]."\" alt=''>";
?>

perhaps this is an error in the remainder of code HTML ?

Options: ReplyQuote
Re: Embedding PHP scripts
Posted by: CyberSpatium (67.170.181.---)
Date: August 12, 2006 12:07AM

make sure you put your html and php files in you c:wamp\www folder or apache will not parce them.

Options: ReplyQuote


Sorry, only registered users may post in this forum.