Results 1 to 6 of 6

Thread: PHP & html question

  1. #1
    Administrator Bok's Avatar
    Join Date
    Oct 2003
    Location
    Wake Forest, North Carolina, United States
    Posts
    24,466
    Blog Entries
    13

    PHP & html question

    Got a question for any php developers out there.

    In my new version of the stats I'm doing the front end entirely in php. However I'm having problems displaying teams which have spaces in them.

    I'm sure I've had this working before but can't quite seem to get it to work now.

    i.e. in my DB I have stored team=Dutch Power Cows

    my php script reads this for Free-DC

    http://stats.free-dc.org/new/teamsta...c&team=Free-DC

    but how to I put in Dutch Power Cows into that URL and then have the script decode it ?

    I've messed about putting in %20's, +'s and also using urldecode etc, but without success. I'm sure it's something obvious I'm overlooking but would appreciate any insight!

    Bok

  2. #2
    Stats God in Training Darkness Productions's Avatar
    Join Date
    Dec 2001
    Location
    The land of dp!
    Posts
    4,164
    First, I must suggest not using names, but using numbers. Much simpler.

    But if you're going to use names, check out php's urldecode and urlencode to make the text nice and usable

  3. #3
    Administrator Bok's Avatar
    Join Date
    Oct 2003
    Location
    Wake Forest, North Carolina, United States
    Posts
    24,466
    Blog Entries
    13
    That's what I've been trying.

    When I put this in

    http://stats.free-dc.org/new/teamsta...20Power%20Cows

    and then try

    $team2=urldecode($team);

    team2 is DutchPowerCows;

    similarly if I do

    $team2=htmlspecialchars(urldecode($team));

    I could use the projectrank for the teams instead, it's just that putting that as the index and updating the index often is not nice

    Bok

  4. #4

  5. #5
    Administrator Bok's Avatar
    Join Date
    Oct 2003
    Location
    Wake Forest, North Carolina, United States
    Posts
    24,466
    Blog Entries
    13
    Thanks DP,

    I've actually just fixed it, though fix is not a good word here. I think I should throw myself off a virtual cliff

    Remebering the name of my variables (i.e. $team ) .... I had an

    include '../generalconfig.inc';

    at the top of my script (I use it in all of the scripts) which contained (amongst other things)

    $team = ereg_replace (' ','', $team);
    $team = ereg_replace ('.html','', $team);




    /me feels stupid

    Bok

  6. #6

Posting Permissions

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