You are here: Re: Form to append text to end of choice of URL's « PHP Programming Language « IT news, forums, messages
Re: Form to append text to end of choice of URL's

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 />';
> > }
> > }
> > ?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация