Posted by BKDotCom on 11/22/53 11:55
"typo"
I didn't change the $_GET['symbol'] from my frist post to
$_POST['symbol']
make the change and all is well
Dan wrote:
> That seems to be what I want to do except that the symbol is not being
> replaced. I just get an empty end of line
> (http://bigcharts.marketwatch.com/intchart/frames/frames.asp?symb=)
>
>
>
>
> BKDotCom wrote:
> > reading your post again I see you don't want the "?" in your urls.
> > That's a result of using the "get" method with your form (the default)
> > here's a more complete code for your page:
> >
> > <?php
> >
> > $sites = array(
> > 'marketwatch' =>
> > 'http://bigcharts.marketwatch.com/intchart/frames/frames.asp?symb=%s',
> > 'someothersite' => 'http://www.blah.com/?ticker=%s&something=foo',
> > );
> >
> > if ( !isset($_POST['symbol']) )
> > $_POST['symbol'] = '';
> >
> > ?>
> >
> > <FORM method="POST">
> > <INPUT type="text" name="symbol" value="<?php echo
> > htmlspecialchars($_POST['symbol']); ?>" />
> > </FORM>
> >
> > <?php
> > if ( !empty($_POST['symbol']) )
> > {
> > // loop through the sites
> > foreach ( $sites as $name => $url )
> > {
> > $url = sprintf($url,urlencode($_GET['symbol'])); // replaces %s with
> > your symbol
> > echo '<A HREF="'.$url.'">'.$name.'</A><BR />';
> > }
> > }
> > ?>
[Back to original message]
|