[SOLVED] Validate this!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mhulse
Forum Commoner
Posts: 41
Joined: Fri Jun 11, 2004 12:50 am

Validate this!

Post by mhulse »

Hi all,

I am having troubles getting this to validate (XHTML 1.0 Transitional):

Code: Select all

echo "&nbsp;<a href="$PHP_SELF?action=delete&id=$key">Delete</a>\n";
    echo "&nbsp;<a href="$PHP_SELF?action=edit&id=$key">Edit</a>\n";
Putting them in vars did not seem to work... And yes, I am a PHP noob, sorry :(

Any suggestions?
Thanks in advance!
Cheers
<m />
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Try:
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$key.'">Delete</a>'."\n";
echo '<a href="'.$_SERVER['PHP_SELF'].'?action=edit&id='.$key.'">Edit</a>'."\n";
mhulse
Forum Commoner
Posts: 41
Joined: Fri Jun 11, 2004 12:50 am

Post by mhulse »

Wow! Fast response! Thanks!

I gave that a shot, but the validator still does not like this part:

Code: Select all

&id=
This is the only part of my page that does not validate... am I being too anal about making my pages compliant?
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

You cannot use & for XHTML Transitional - change to &
mhulse
Forum Commoner
Posts: 41
Joined: Fri Jun 11, 2004 12:50 am

Post by mhulse »

Thanks guys! Perfect XHTML validation:

Code: Select all

echo '<a href="'.$_SERVER&#1111;'PHP_SELF'].'?action=delete&id='.$key.'">Delete</a>'."\n"; 
	echo '<a href="'.$_SERVER&#1111;'PHP_SELF'].'?action=edit&id='.$key.'">Edit</a>'."\n";
Thanks for helping me out, I really appreciate it!

Cheers
<m />
Post Reply