SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Simple idiot-proof $_REQUEST[] meets idiot !! PLEASE LOOK !!

    hi guys,

    going nuts here. WATCH variable "cd". WHY WON'T IT PRINT !!!

    ########################################################

    my PHP code:
    if ($access) { echo " onclick=\"x=eventWin('index.php?cP=11&id=".$eid."&cd=".$date."'); x.focus(); return false;\""; }

    generates this source code:
    <div class="item point" style="color: #000000; background: #FF4444;" onclick="x=eventWin('index.php?cP=11&amp;id=3&amp;cd=2012-02-29'); x.focus(); return false;" onmouseover="...

    then I echo:
    echo "event ID: " . $_REQUEST['id'] . "<br />";
    echo "calendar's Date: " . $_REQUEST['cd'] . "<br />";
    die();

    ########################################################

    all vars present in URL, but just the value for id prints... why not cd!! have tried re-arranging things and substituting literal values with no luck, and no more ideas.

    any ideas at all are welcome! thank you!

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Run var_dump on $_GET. And do not use $_REQUEST...
    PHP Code:
    var_dump$_GET ); 
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by logic_earth View Post
    Run var_dump on $_GET. And do not use $_REQUEST...
    PHP Code:
    var_dump$_GET ); 
    done, getting:
    array(1) { ["cP"]=> string(2) "11" } , that's all she wrote... ???

  4. #4
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    var_dump($_GET['cd']);

    returns NULL

  5. #5
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if I swap $date and $id then $date WILL print, and id does not...

    var dump for all 3:
    print "event ID: " . $_REQUEST['id'] . "<br />";
    print "calendar's Date: " . $_REQUEST['cd'] . "<br />";
    var_dump($_REQUEST['cP']); // prints string(2) "11"
    var_dump($_REQUEST['id']); // prints string(1) "3"
    var_dump($_REQUEST['cd']); // prints NULL
    die();

  6. #6
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks ROBINGAGA, but do not understand your message...

  7. #7
    SitePoint Guru
    Join Date
    Nov 2003
    Location
    Huntsville AL
    Posts
    689
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I'm guessing your javascript has an error in it. Use something like firebug to see exactly what is being sent back to the server.

  8. #8
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    What exactly is supposed to fill 'cd'?
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  9. #9
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by StarLion View Post
    What exactly is supposed to fill 'cd'?

    it's a date. see source code below

    my PHP code:
    if ($access) { echo " onclick=\"x=eventWin('index.php?cP=11&amp;id=".$eid."&amp;cd=".$date."'); x.focus(); return false;\""; }

    generates this source code:
    <div class="item point" style="color: #000000; background: #FF4444;" onclick="x=eventWin('index.php?cP=11&amp;id=3&amp;cd=2012-02-29'); x.focus(); return false;" onmouseover="...

  10. #10
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    and what's the code for eventWin? Cause it's not a standard function afaik...
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  11. #11
    SitePoint Zealot
    Join Date
    Oct 2009
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks StarLion... I am modifying someone else's code to suit my needs. am adding one var to URL string. upon closer examination I see I am in over my head. would appreciate greatly any help with this! need to make sense of this:

    the problem lies somewhere in here: // runs AFTER my mod

    $link='%<a\s[^<>]*?href="http://([\w-_./?&=#]{5,})"[^<>]*?>([^<>]*?)</a>%';
    $_POST["description"] = preg_replace($link,'[$1|$2]',$row["description"]);

    looks like I need to add a 3rd field to $link but will struggle with syntax.. do you happen to know correct format please?


Bookmarks

Posting Permissions

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