Jump to content

Archived

This topic is now archived and is closed to further replies.

Orphy

Fix my syntax please

Recommended Posts

[code]<HEAD>
<TITLE>Test page</TITLE>
</HEAD>
<BODY>


<FORM METHOD="get" ACTION="graphtest.html">
<INPUT TYPE=hidden NAME=choice VALUE=request>
Type stock symbol(like: bby)  
<INPUT TYPE="text" SIZE="20" NAME="search" VALUE="">
<INPUT TYPE="submit" VALUE="Search!">
</FORM>

<?php

if ($choice == request)
{

echo "<img src= "http://ichart.finance.yahoo.com/z?

s=""$search""&t=1y&q=c&l=on&z=m&a=v&p=s/>""

};
?>

</BODY>
</HTML>

[/code]


Please look at the echo feature, I do not know how to use the proper syntax . Basically I want a user to submit a symbol and I will give out the graph and that graph is in [a href=\"http://ichart.finance..\" target=\"_blank\"]http://ichart.finance..[/a]. url.

The $search would be the input. So basically if someone typed BBY in the box, the output will give the graph of bby.

Many thanks.

Share this post


Link to post
Share on other sites
How can it be hidden and inputted in the same form ? if its hidden then it has obviously come in from an earlier page .
Also,

[code]<INPUT TYPE="text" SIZE="20" NAME="search" VALUE="">


should be

<INPUT TYPE="text" SIZE="20" NAME="search" >[/code]

HTH

Share this post


Link to post
Share on other sites

Thank you swat, I will fix this and see what happens but before that I am getting error on "echo" line.

Is that how it supposed to be given waht I want as mentioned above. I can follow logic but not syntax.

Share this post


Link to post
Share on other sites
[!--quoteo(post=358318:date=Mar 25 2006, 06:28 PM:name=Orphy)--][div class=\'quotetop\']QUOTE(Orphy @ Mar 25 2006, 06:28 PM) [snapback]358318[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Thank you swat, I will fix this and see what happens but before that I am getting error on "echo" line.

Is that how it supposed to be given waht I want as mentioned above. I can follow logic but not syntax.
[/quote]

There are a couple of errors I can see:

[code]<?php
if ($choice == request) {
// The above line may need to read
// either "$request" or "'request'"

echo "<img src= "http://ichart.finance.yahoo.com/z?s=""$search""&t=1y&q=c&l=on&z=m&a=v&p=s/>""
// This line should be:
// echo "<img src=\"http://ichart.finance.yahoo.com/z?s=".$search."&t=1y&q=c&l=on&z=m&a=v&p=s\" />";

};
?>[/code]

Share this post


Link to post
Share on other sites
Hey gast, thank you very much for taking the time out to reply, Yes the code looks cleaner now.

But I am still getting an error. Basically the error is in the whole php codes I think. Thats what I see in dreamweaver.

Is the code logical?

Basically what am I trying to do is, take the user's input and stick in the $search of yahoo url.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.