Results 1 to 3 of 3

Thread: Form Problem

  1. #1
    Join Date
    May 2002

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

  2. #2
    Join Date
    Nov 2001
    PHP variables can not have spaces in them so it turns them into "_".

    Thus you have to call it like this:

  3. #3
    Join Date
    May 2002
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts