I need help grabbing the value of a variable with a dynamic

Discussion in 'PHP' started by primogeeko, Apr 21, 2011.

  1. #1
    Hi there guys,

    on the form page, I generated a random 4 digit number. I then appended that number to the beginning of my html form elements, so:

    using
    so output would be random 4 digit + testtext
    output: 1234testext

    I got that part figured out just fine. My problem is that when submitting the form it has to begin with letter because im trying to parse a textarea and limit it (long explanation), i want to add a letter im trying this
    which should output: x1234testext

    but it does not work i get this error

    so meaning the letter i put which is x doesnt show up, hope someone here get what i was trying to say. :( its hard for me to explain since im new to php.

    Pls help.
     
    primogeeko, Apr 21, 2011 IP
  2. littlejohn199

    littlejohn199 Peon

    Messages:
    42
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Maybe try this
    $testtext = mysql_real_escape_string (strip_mq_gpc (substr ($_POST[$_SESSION['AS_seed'].'testtext'], 0, 2000)));

    Then append x to $testtext;

    $testtext = 'x'.$testtext;

    Little John
     
    littlejohn199, Apr 21, 2011 IP
  3. primogeeko

    primogeeko Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    nope it does not work :(

    so sad.. anyway thanks for the help..
     
    primogeeko, Apr 21, 2011 IP
  4. x319

    x319 Well-Known Member

    Messages:
    90
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    103
    #4
    Since you've added 'x' to the form object, don't you think you should put the 'x' preceding the index in the $_POST variable?

    i.e:
    $testtext = mysql_real_escape_string (strip_mq_gpc (substr ($_POST['x'.$_SESSION['AS_seed'].'testtext'], 0, 2000)));
    PHP:
     
    x319, Apr 21, 2011 IP