RE: [PHP] Form Posting % characters
| From: | Joe Kaiping | Date: | Sat, 29 Sep 2001 00:00:47 +0000 |
| Subject: | RE: [PHP] Form Posting % characters | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-69234@lists.php.net to get a copy of this message | ||
Hi there,
You might just set the option values to be like:
<OPTION VALUE="$row[ServerID]|$row[ServerName]">$row[ServerName]
and then do a:
list($id, $name) = explode("\|", $server_id);
when the form is submitted to the PHP script.
(you may not need to escape the | in the explode. I forget.)
-Joe
> -----Original Message-----
> From: Montz, James C. (James Tower) [mailto:JCMontz@jamestower.com]
> Sent: Friday, September 28, 2001 3:41 PM
> To: Php-General (E-mail)
> Subject: [PHP] Form Posting % characters
>
>
> How can I get a select form to pass more than just value?
>
> In the following code, I tried extended the <option
> value=...> with the
> information I want to pass to the next page, but as written
> things like &
> and = are converted to %??.
>
> How can I prevent this? Or is there another way I should
> implement this?
>
> CODE
>
> print "<form method=GET action=asset.php>\n";
> print "<select size=1 name=serverid>\n";
> $link=mysql_connect("localhost",$user,$pass);
> if ( ! $link )
> die("Could Not Connect to MySQL!");
> mysql_select_db($db, $link)
> or die ("Could Not Open $db: ".mysql_error() );
> $result=mysql_query( "SELECT ServerName, ServerID FROM TblServer");
> while ($row = mysql_fetch_array ($result))
> {
> print "<option
> value=$row[ServerID]&servername=$row[ServerName]>$row[ServerNa
> me]</option>\n
> ";
> }
> print "</select>\n";
> print "<input type=submit value=\"Get Record\">\n";
> print "</form>\n";
>
>
> Results in:
>
>
> http://www.whatever.com/assett.php?serverid=1%26servername%3DServerOne
>
>
>
> ___________________________
> James C. Montz
> James Tower
> http://www.jamestower.com
> <http://www.jamestower.com>
> jcmontz@jamestower.com
>
>
>