Re: [PHP] Session variables and words with spaces
Perhaps you should load up your initial form and then use the view source option in your browser as this will probably give you insight into your problems... -Brad 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 !! Rest of Form !! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session variables and words with spaces
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 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session variables and words with spaces
Thanks - Done that though. It shows the way it should be. Example: option value=Niagara FallsNiagara Falls/option -Original Message- From: Brad Bonkoski [mailto:[EMAIL PROTECTED] Sent: May 31, 2006 2:28 PM To: Beauford Cc: php-general@lists.php.net Subject: Re: [PHP] Session variables and words with spaces Perhaps you should load up your initial form and then use the view source option in your browser as this will probably give you insight into your problems... -Brad 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 !! Rest of Form !! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session variables and words with spaces
Beauford wrote: Thanks - Done that though. It shows the way it should be. Example: option value=Niagara FallsNiagara Falls/option which of course is wrong and explains perfectly why you are getting the results you are getting... it *should* display: option value=Niagra FallsNiagra Falls/option (View source is a powerful tool!) -Brad -Original Message- From: Brad Bonkoski [mailto:[EMAIL PROTECTED] Sent: May 31, 2006 2:28 PM To: Beauford Cc: php-general@lists.php.net Subject: Re: [PHP] Session variables and words with spaces Perhaps you should load up your initial form and then use the view source option in your browser as this will probably give you insight into your problems... -Brad 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 !! Rest of Form !! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session variables and words with spaces
option value=Niagara FallsNiagara Falls/option replace with option value=Niagara FallsNiagara Falls/option (note the quotes) because you will post only Niagara instead Niagara Falls cheers, On 5/31/06, Beauford [EMAIL PROTECTED] wrote: Thanks - Done that though. It shows the way it should be. Example: option value=Niagara FallsNiagara Falls/option -Original Message- From: Brad Bonkoski [mailto:[EMAIL PROTECTED] Sent: May 31, 2006 2:28 PM To: Beauford Cc: php-general@lists.php.net Subject: Re: [PHP] Session variables and words with spaces Perhaps you should load up your initial form and then use the view source option in your browser as this will probably give you insight into your problems... -Brad 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 !! Rest of Form !! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session variables and words with spaces
Not sure why I would get a parse error, but that did correct the problem. I just completely missed the single quote. I never even clue'd in when I looked at the source of the page. Sometimes another pair of eyes does the trick. Maybe it's time for a break. Thanks 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 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Session variables and words with spaces
Yep, I see that now. I really need to take a break - been at this way to long. Thanks to all. -Original Message- From: Brad Bonkoski [mailto:[EMAIL PROTECTED] Sent: May 31, 2006 3:02 PM To: Beauford Cc: php-general@lists.php.net Subject: Re: [PHP] Session variables and words with spaces Beauford wrote: Thanks - Done that though. It shows the way it should be. Example: option value=Niagara FallsNiagara Falls/option which of course is wrong and explains perfectly why you are getting the results you are getting... it *should* display: option value=Niagra FallsNiagra Falls/option (View source is a powerful tool!) -Brad -Original Message- From: Brad Bonkoski [mailto:[EMAIL PROTECTED] Sent: May 31, 2006 2:28 PM To: Beauford Cc: php-general@lists.php.net Subject: Re: [PHP] Session variables and words with spaces Perhaps you should load up your initial form and then use the view source option in your browser as this will probably give you insight into your problems... -Brad 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 !! Rest of Form !! -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php