hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : Form Problem
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

Form Problem

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 10-29-2002, 08:43 AM
Rich2k Rich2k is offline
Web Hosting Master
 
Join Date: May 2002
Location: UK
Posts: 2,994

Form Problem


Let's say I have a form

<form method="POST">
Name: <input type="text" name="Name" /><br />
Email: <input type="text" name="Email Address" /><br />
<input type="hidden" name="mandatoryfields" value="Name,Email Address" />
<input type="submit / >

And post this to PHP. I am dynamically checking that the fields in mandatoryfields have something in them.

Now if I create an array from the mandatoryfields and check
if ($_POST[$mandatoryfieldsarray[$i] == "") {
$errorcheck = 1;
}

whilst looping through the array

Now it works fine for any posted variable that DOESN'T contain a space in it. However what I need to know is what the encoded character is in a form post for a space so I can check it (echoing it seems to be fine by looping through the $_POST array but actually calling $_POST['Email Address'] is blank).

Reply With Quote


Sponsored Links
  #2  
Old 10-29-2002, 12:28 PM
michaeln michaeln is offline
Web Hosting Master
 
Join Date: Nov 2001
Posts: 857
PHP variables can not have spaces in them so it turns them into "_".

Thus you have to call it like this:
$_POST['Email_Address'];

__________________
<?
header("Location: http://www.hostevolve.com/");
?>

Reply With Quote
  #3  
Old 10-29-2002, 12:38 PM
Rich2k Rich2k is offline
Web Hosting Master
 
Join Date: May 2002
Location: UK
Posts: 2,994
Ah excellent... I knew there would be an easy answer

I know you can't have spaces in variables but I thought it might be different in the global arrays... obviously not!

Reply With Quote
Sponsored Links
Reply

Related posts from TheWhir.com
Title Type Date Posted
Lead Generation Part 2 – Content Syndication Blog 2012-12-12 12:37:59
Lead Generation Part 1 – Form Fills Blog 2012-11-16 09:03:48
How To Deliver Products Customers Will Pay For with David Koston - HostingCon 2012 Web Hosting News 2012-07-18 10:46:16
eleven Survey Lists Spam as Greatest Email Security Threat in Ten Years Web Hosting News 2011-12-02 21:50:09
Landing Page Practices to Improve Marketing ROI with Tim Ash of SiteTuners Web Hosting News 2011-08-09 22:20:06


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?