php forum
php mysql forum
php mysql smarty
 
Topic Options
#311960 - 11/13/06 11:39 AM Spaces getting removed
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 133
Loc: New Mexico

   Spaces getting removed to Del.icio.us Add to del.icio.us
  Digg Spaces getting removed Digg it
I'm trying to build an integrated page that requires input from the user via a forum. The variable in the form gets passed to the "script" file ok, but the space between words gets removed, so, for example, "Austin Healey" (a selection from a drop down on my form) becomes: "AustinHealey". Any idea why this happens and is there anything I can do about it?

Thanks,
Basil
_________________________

Top
#311961 - 11/13/06 04:06 PM Re: Spaces getting removed [Re: Basil Fawlty]
chillin Offline
Journeyman

Registered: 01/26/03
Posts: 127
Loc: bend, OR USA
is your form using POST or GET? Maybe the variable isn't being encoded properly.
_________________________
i see threads people
http://www.chinooktc.com

Top
#311963 - 11/13/06 07:50 PM Re: Spaces getting removed [Re: chillin]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 133
Loc: New Mexico
Like this:

Code:
<FORM ACTION="ubbthreads.php?ubb=mypage" METHOD="POST" ENCTYPE="application/x-www-form-urlencoded"> 
_________________________

Top
#311965 - 11/14/06 01:53 PM Re: Spaces getting removed [Re: Basil Fawlty]
chillin Offline
Journeyman

Registered: 01/26/03
Posts: 127
Loc: bend, OR USA
And what does your input array look like on mypage.inc.php... maybe you have the resulting field being mapped incorectly?
_________________________
i see threads people
http://www.chinooktc.com

Top
#311967 - 11/14/06 02:46 PM Re: Spaces getting removed [Re: chillin]
Micky Offline
Member

Registered: 02/11/04
Posts: 183
Loc: Bern, Switzerland
Hi,
tries sometimes these two lines from header.tpl out increase.

Quote:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="{$lang.READ_DIRECTION}">
_________________________
Gruss Micky

Top
#311968 - 11/14/06 03:24 PM Re: Spaces getting removed [Re: chillin]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 133
Loc: New Mexico
Originally Posted By: chillin
is your form using POST or GET? Maybe the variable isn't being encoded properly.


It looks like this:
Php Code:
"input" => array(
			// This is an array of variables that you expect from the user
			// "varname" => array("fieldname","requesttype","vartype");
			// requesttype can be either "get", "post" or "both"
			// vartype can be "int", "alpha", "alphanum" or just blank if it can contain any characters
			"var1" => array("var1","post","alpha"),  


Where var1 is the variable name that gets past via the form input. If the selection on the form is, for example, "Michael Jordan" then that gets passed in the var1 variable, but when it gets to the script file, (.inc.php) it looses the space and becomes "MichaelJordan"
_________________________

Top
#311971 - 11/14/06 05:15 PM Re: Spaces getting removed [Re: Basil Fawlty]
chillin Offline
Journeyman

Registered: 01/26/03
Posts: 127
Loc: bend, OR USA
Thats whats stripping the spaces from your variable

change your var input to

Code:
"var1" => array("var1","post",""),


and the preg_replace function that is stripping your spaces won't mess with your variable anymore!
_________________________
i see threads people
http://www.chinooktc.com

Top
#311972 - 11/14/06 07:46 PM Re: Spaces getting removed [Re: chillin]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 133
Loc: New Mexico
YES!!! That did it! Thanks! I guess the answer was right there in front of my face the whole time: "or just blank if it can contain any characters" and somehow I just zoned that out.

Basil
_________________________

Top
#311975 - 11/15/06 11:24 AM Re: Spaces getting removed [Re: Basil Fawlty]
chillin Offline
Journeyman

Registered: 01/26/03
Posts: 127
Loc: bend, OR USA
we've all been there. i for the life of me couldn't figure out why a file upload form I made wasn't working, when after 30 mins I realized that i had my form encoding wrong.
_________________________
i see threads people
http://www.chinooktc.com

Top
#311997 - 11/16/06 04:59 PM Re: Spaces getting removed [Re: chillin]
Basil Fawlty Offline
Journeyman

Registered: 10/30/01
Posts: 133
Loc: New Mexico
Yeah, sometimes the simplest problems can take the longest to figure out because your not looking for the obvious!
_________________________

Top
#312018 - 11/16/06 07:27 PM Re: Spaces getting removed [Re: Basil Fawlty]
Gizmo Administrator Online   shocked
Wizard

Registered: 01/10/00
Posts: 5122
Loc: Portland, OR, USA
lol, its all new though, so at least its understandable
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design Owner

Top


Who's Online
0 Registered (), 41 Guests and 8 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Blogs, love em or hate em?
by AllenAyres
Today at 02:05 PM
What do you use to edit the files
by Ian_W
10/05/08 03:33 PM
BeyondCompare v3.00
by Ian_W
10/05/08 03:32 PM
Glossy Black Theme with Image Reflection
by Gizmo
10/05/08 02:17 PM
ShareThis
by Gizmo
09/28/08 05:06 AM
[7.3] Viewing MySQL logfiles made easier
by AllenAyres
09/27/08 09:57 PM
Looking for a simple upload script
by Murphdog
09/26/08 08:45 PM
New Mods
[7.3] Viewing MySQL logfiles made easier
by blaaskaak
09/24/08 05:39 PM
[7.3] Language file checker
by blaaskaak
09/09/08 12:56 AM
[7.3.1] add search to showmembers page
by blaaskaak
09/07/08 04:50 AM
Multiple Identity Detector
by
12/30/06 06:39 PM
Newest Members
pisa666, ghengis317, NitroX, Dogan, EliYah-
13345 Registered Users
Top Posters Last 30 Days
AllenAyres 18
blaaskaak 12
FREAK1 7
Mike L_dup1 4
Chris Bale 4
Ian_W 4
tackaberry 4

 

 

 
fusionbb message board php hacks