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
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

Golf Diesel Forum

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 Offline
Wizard

Registered: 01/10/00
Posts: 5133
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 (), 27 Guests and 12 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Spell Check [beta]
by Bill B
Yesterday at 09:16 PM
PhotoPost BB Code Popup
by AllenAyres
Yesterday at 09:41 AM
Problems reading a lot of old posts here
by AllenAyres
Yesterday at 09:35 AM
Forum 'Trader Ratings'.
by AllenAyres
Yesterday at 09:33 AM
Customization needed
by Gizmo
11/12/08 12:28 PM
Team UBBDev Rides Again!
by AllenAyres
11/11/08 02:16 PM
Active Topics.
by AllenAyres
11/11/08 02:13 PM
New Mods
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Spell Check [beta]
by
10/17/06 09:24 PM
Newest Members
David DelMonte, nick1, Begbie, cenk, MATTO
13363 Registered Users
Top Posters
AllenAyres 25452
JoshPet 11330
Rick 8372
LK 7396
Lord Dexter 6503
Greg Hard 5533
Charles Capps 5438

 

 

 
fusionbb message board php hacks