Previous Thread
Next Thread
Print Thread
Rate Thread
#311960 11/13/2006 12:39 PM
Joined: Oct 2001
Posts: 139
Journeyman
Journeyman
Joined: Oct 2001
Posts: 139
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

Sponsored Links
Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
is your form using POST or GET? Maybe the variable isn't being encoded properly.

Joined: Oct 2001
Posts: 139
Journeyman
Journeyman
Joined: Oct 2001
Posts: 139
Like this:

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

Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
And what does your input array look like on mypage.inc.php... maybe you have the resulting field being mapped incorectly?

Joined: Feb 2004
Posts: 182
Member
Member
Joined: Feb 2004
Posts: 182
Hi,
tries sometimes these two lines from header.tpl out increase.

Quote



Sponsored Links
Joined: Oct 2001
Posts: 139
Journeyman
Journeyman
Joined: Oct 2001
Posts: 139
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"

Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
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!

Joined: Oct 2001
Posts: 139
Journeyman
Journeyman
Joined: Oct 2001
Posts: 139
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

Joined: Jan 2003
Posts: 125
Journeyman
Journeyman
Joined: Jan 2003
Posts: 125
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.

Joined: Oct 2001
Posts: 139
Journeyman
Journeyman
Joined: Oct 2001
Posts: 139
Yeah, sometimes the simplest problems can take the longest to figure out because your not looking for the obvious!

Sponsored Links
Joined: Jan 2000
Posts: 5,833
Likes: 20
UBBDev / UBBWiki Owner
Time Lord
UBBDev / UBBWiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,833
Likes: 20
lol, its all new though, so at least its understandable


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, My UBB Scripts

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)