Jump to content

Fix my syntax please


Orphy

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.
Link to comment
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]
Link to comment
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.