Your Ad Here

 Navigation
Home
Source code
Tutorials
RSS feeds
Articles
Wordpress plugins
Books
Sample Chapters
Software
Downloads
Hosting
manuals
Script directory
Training
Our Links




 Sponsors
 Links
domain names
software directory
wwwstores
 Downloads
dzphp editor
EasyPHP
mysql_phpgenerator
php-studio-trial
phpdesigner_7_2_5
phpMyAdmin-3.4.3.2
/phptriad2-2-1
phpxedit_321
rapidphp 2011
WampServer2.1d-x64
WampServer2.1e-x32
xampp-win32-1.7.4-VC6-installer
xampplite-win32-1.7.3
 Misc
Webmaster Resources
Only PHP
ScriptSearch.com
Scripts.com - Get the best scripts NOW!
AndreaPHP Programming

Valid XHTML 1.0 Transitional


Valid CSS!


Displaying a daily chart for a ticker symbol


Displaying a daily chart for a ticker symbol

The normal method of showing stock information for a selected ticker symbol is pure numerical data , now this is fine but on a lot of financial sites they are able to display charts as well . This would be great if you could add this to our site well stay tuned as I am going to show you how to .

First grab the script here stockchart.txt change the extension to .php and away you go . Run the script and enter a valid ticker symbol and the chart will be displayed .

How it works.

Well firstly we check to see if anything has been entered in the text box if the answer is no the form is shown again . Here is this section of code .

<?php
//stock chart shower
//Beginners PHP
//Created by Iain Hendry
//Description : This allows a user to enter a ticker symbol
//and rather than the usual dry quotes displays a chart of
//how the stock has performed over the whole year

if ($symbol =="")
{
?>
<html><body>
<form action = <?php print $PHP_SELF; ?> method = post>
Enter your ticker symbol :<input type = text name = symbol size = 6><br>
<input type = submit value = "show chart">
</form>
</body></html>

Now we move on to the next part which is if a ticker symbol has been entered the necessary chart will be displayed .

<?php
}
else
{
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="image/gif; charset=iso-8859-1">
</head>
<img border="0" src="http://ichart.yahoo.com/t?s=<?php print $symbol; ?>">

</body>
</html>
<?php
}
?>

The key line is of course the image itself , all we are doing is taking the url from yahoo's website and adding the symbol in the text box to it .

 




Books
 Sponsors


 Random Code
an example of a class in php(beginner)
yahoo science feed(xml)
PI value(math)
 Random Article
  Network
Programming resources
Tutorials directory
Hosting resources
ASP site
Domain names
Progged
Maxi directory
bigarticle : free articles
A Code
Code N Tutorials
Get PHP
Programmers help




beginners PHP Copyright © 2004 onwards by beginnersPHP.