Posted by BKDotCom on 12/17/84 11:55
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]
|