How to echo from a post form?

Discussion in 'PHP' started by Neo_The_One, Jul 10, 2008.

  1. #1
    Hi, Guys!

    I need some help if any one knows how to fix this! ;)


    test5.php?custom clickbank id=testing&custom passwd=test&custom password=test&custom website=test&from=test222%40aol.com&meta_adtracking=test&meta_message=1&meta_required=from&meta_split_id=&meta_web_form_id=1857252391&submit=Submit&unit=test
    PHP:
    this is my random form submission as you se:

    test5.php?custom clickbank id=testing&
    PHP:
    There are spaces between the words, and they must be there when submitting a form because of the auto responder i use but if i echo like this:

    <?php echo $_REQUEST["custom clickbank id"]; ?>
    PHP:
    If i rename the form to like

    <?php echo $_REQUEST["customclickbankid"]; ?>
    PHP:
    This works!


    But i need it to work without renaming it... ?

    Any ideas??
     
    Neo_The_One, Jul 10, 2008 IP
  2. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #2
    variables cannot contains spaces, and fields comming through get or post cannot have spaces. There are few standards why must be followed.

    "custom clickbank id" is wrong

    if you print the _GET array you see a variable with name 'custom' only.

    print_r($_GET);


    Let me know why you need variables with spaces, we can adopt some other way to meet your needs.

    regards
     
    Vooler, Jul 10, 2008 IP
  3. Neo_The_One

    Neo_The_One Active Member

    Messages:
    555
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Hi,

    Thx for the answer but my script automaticly does that and that`s why i need to echo it including the spaces?

    If you could just write the whole "PHP COMMAND" to echo the whole thing.


    Thx!
     
    Neo_The_One, Jul 10, 2008 IP
  4. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #4
    Extremely sorry, but I still did not follow, what exactly is the scenario you wish to implement.

    regards
     
    Vooler, Jul 10, 2008 IP
  5. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #5
    <?php echo $_REQUEST["custom_clickbank_id"]; ?>
     
    Danltn, Jul 10, 2008 IP
    Vooler likes this.
  6. Neo_The_One

    Neo_The_One Active Member

    Messages:
    555
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #6
    Great thx pal! ;)

    Working just fine! :) Juppi!
     
    Neo_The_One, Jul 10, 2008 IP
  7. Vooler

    Vooler Well-Known Member

    Messages:
    1,146
    Likes Received:
    64
    Best Answers:
    4
    Trophy Points:
    150
    #7
    How could I not remember this, my bad, very good dig Dan once again.

    For other readers? because Dan did not clarify what code is about.
    Any variable that is passed including spaces are automatically replaced with underscore.

    In your case, you need to put this little function somewhere in code
    function make_id($str) { return str_replace(' ','_',$str); }

    and call as

    <? $_REQUEST[ make_id("custom clickbank id") ]; ?>


    I hope it is clear now.
     
    Vooler, Jul 10, 2008 IP
  8. Danltn

    Danltn Well-Known Member

    Messages:
    679
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    120
    #8
    To extrapolate, in a variable any character which would turn into an invalid variable is turned into an underscore.

    Without going into detail its anything which doesn't fit the pattern: [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
     
    Danltn, Jul 10, 2008 IP