<form id="form1" name="form1" method="get" action="">
<div align="center">Geef ticker :
<input name="stock" type="text" value="<? if(isset($_GET['stock'])){ echo ''.$_GET['stock'].'';}else { echo 'GOOG';} ?>" size="20" maxlength="10" />
<input type="submit" name="Submit" value="info" />
</div>
</form>
<p align="center"><?
$stock = $_GET['stock'];
if(empty($_GET['stock'])){ $stock = 'GOOG';}
if ($stock != "") {
?>
<?php
//Reads stock information from symbol entered
$yahoo_file = fopen ("http://finance.yahoo.com/d/quotes.csv?s=$stock&f=sl1d1t1c1ohgv&e=.csv","r");
//Grabs information and dumps it into $stock_info
$stock_info = fgetcsv ($yahoo_file, 1000, ",")
//The arrays below tell the script where to read the data from within the .csv file
?>
<?php echo $stock_info[1] ?>
<?php echo "<span style=\"";
# If we gained print the percentage in GREEN
if ($stock_info[4]>0) {
echo "color: #009900;";
} # if we lost RED
elseif ($stock_info[4]<0) {
echo "color: #990000;";
} # No color
else {
echo "font-weight: normal;";
}
echo "\">".$stock_info[4]."</span></li>\n";
?>
<?
//Prints copyright infomation
} else {
echo"Geen ticker informatie, credits : jimmyharmon.com";
} ?>