why is . converted to _ in $_POST

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default why is . converted to _ in $_POST

    I have a form that contains some file names (eg this.jpg). When the form
    posts, and i ready $_POST, I get back this_jpg.

    What is happening? how can I turn this off?

    --
    jcg
    ColumbusWebMakers.com
    jcg Guest

  2. Similar Questions and Discussions

    1. Variable _POST
      Bonsoir, Je passe des variables de formulaire par la méthode post, quelle est la méthode la plus sécurisante pour la reception des données : ...
    2. [PHP] dump $_POST into variables????
      Ah... Jason.... Man Of Few Words! THANKs... You have saved me time and lines in my code :-) Cheers! Joe -----Original Message----- From:...
    3. dump $_POST into variables????
      Okay, curious if there is an easier way to do this... here is what I do <?php $ZipCode = $_POST; $Distance = $_POST; ?> can't I just dump...
    4. [PHP] $_POST problem
      Nope. That didn't do it. The errors I'm receiving are: Notice: Undefined index: keywords in...
    5. $_POST problem
      Anyone see what when I submit this, I can't do a $_POST on it? I check with the DB first to see if there is a value and if so, I fill it,...
  3. #2

    Default Re: why is . converted to _ in $_POST

    On Thu, 27 May 2004 20:10:51 GMT, jcg <hpwebby@ameritech.net> wrote:
    >I have a form that contains some file names (eg this.jpg). When the form
    >posts, and i ready $_POST, I get back this_jpg.
    As the key presumably, and NOT the value?
    >What is happening? how can I turn this off?
    PHP used to set global variables based on the names of form elements
    submitted. Variable names cannot contain '.', so '.' got transformed to '_' in
    the variable name.

    Looks like this is still being done in $_POST, despite it being unnecessary
    (and arguably wrong). Don't believe you can turn it off without editing PHP.

    From PHP 4.3.6, see main/php_variables.c:102

    /* ensure that we don't have spaces or dots in the variable name (not
    binary safe) */
    for (p=var; *p; p++) {
    switch(*p) {
    case ' ':
    case '.':
    *p='_';
    break;
    }
    }

    --
    Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
    [url]http://www.andyh.co.uk[/url] / [url]http://www.andyhsoftware.co.uk/space[/url]
    Andy Hassall Guest

  4. #3

    Default Re: why is . converted to _ in $_POST

    Thanks Andy. I decided the quick fix was to do a string replace of _jpg to
    ..jpg

    I didn't realize . is illegal in a variable name. It kinda makes sense
    though since that would confict with css.

    newsgroups are great!

    Joel Goldstick


    Joel Goldstick Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139