Input name

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Garry Jones

    #1

    Input name

    Depending on certain other conditions I need to read in a specific input
    name from a form.

    This works...

    $works=$_POST['realname'.];

    But occasionally there is a value of x in this name that can be changed by
    other conditions.

    When processing the form I can not get this syntax right. I have tried these
    variations.

    $test1=$_POST['realname'.$x];
    $test2=$_POST['realname' & $x];
    $test3=$_POST["'realname' & $x"];
    $test4=$_POST['realname$x'];
    $test5=$_POST['realname'$x];
    $test6=$_POST["'realname' " & "$x"];

    Any ideas of the syntax when including a variable x in a $post input
    reading?

    Garry Jones
    Sweden


  • Sidonath

    #2
    Re: Input name

    $value = $_POST['realname' . $x];

    and

    $value = $_POST["realname$x "];

    should both work if $x is alphanumeric character [a-zA-Z0-9_]. If $x
    contains dot '.' you need to replace it with underscore '_' (e.g.
    result of image map).

    If this doesn't help, post a bit more code and examples

    Cheers

    Comment

    Working...