php

Discussion in 'Software' started by trentw2323, Sep 30, 2004.

  1. trentw2323

    trentw2323 Private E-2

    ok im working on one of my first database driven sites. When a username clicks on a link with their name, i want it to call a function that gets a list of all of thier data and puts it in a new window.
    i was thinking of
    Code:
    <A HREF="functionname($user)" target="_blank">$user</a>

    i know this isnt correct. how do i call that function?
     
  2. goldfish

    goldfish Lt. Sushi.DC

    A function returns a value. Simply writing the function name will do nothing. You need to echo the function

    PHP:
    echo "<a href='somepage.php?user=$user)' target='_blank'>$user</a>";
    You would then have the other page use the $_GET['user'] variable to find the user and print out the various details.

    I'd also suggest not using the username itself to call functions, rather an ID referring to the record.

    Otherwise you open yourself to some quite serious risks in terms of security.
     
  3. trentw2323

    trentw2323 Private E-2

    let me make sure i have this correct.
    instead of
    Code:
    <A HREF="functionname($user)" target="_blank">$user</a>
    use
    Code:
    echo "<a href='somepage.php?user=$user)'target='_blank'>$user</a>"; 
    then in the somepage.php i could
    Code:
    a=$_GET['user']
    If i understand this correct please let me know.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds