Re: Session variables and words with spaces

From: Date: Wed, 31 May 2006 18:29:30 +0000
Subject: Re: Session variables and words with spaces
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-237156@lists.php.net to get a copy of this message
Beauford wrote:
Hi, I have a form in which a drop down field is populated from a MySQL database. I am also using sessions. The problem is this. After I submit the form the session variable only shows the part of the input before the space. Example: if I choose Niagra Falls from the drop down list, then I only see Niagra when I display it. I'm not sure though if it is the session or the forms variable that is causing the problem. I haven't been able to find much on this. See code below.... Thanks session_start( ); ......Open database and connect to server....... Include("connect.inc"); !! Start of form !! <select name="province"> <option selected>-- Select Province --</option> <? $query = "select pid, location from province order by location"; $results = mysql_query($query) or $mysqlerror = mysql_error(); if ($mysqlerror) { $dberror = "Messed Up"; include("index.php"); exit; } while ($line = mysql_fetch_array($results)) { if($line['pid'] == 1) { echo "<Option Value="$line['location'].">"$line['location']."</option>\n"; } } </select>
I'm surprised you're not getting a parse error... echo "<Option Value='" . $line['location'] . "'>" . $line['location'] . "</option>\n"; -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 jnichel@dotcomholdingsofbuffalo.com

« previous php.general (#237156) next »