Page 1 of 1

Validate this!

Posted: Sun Jun 13, 2004 4:03 am
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 />

Posted: Sun Jun 13, 2004 4:05 am
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";

Posted: Sun Jun 13, 2004 4:13 am
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?

Posted: Sun Jun 13, 2004 4:33 am
by launchcode
You cannot use & for XHTML Transitional - change to &

Posted: Sun Jun 13, 2004 4:45 am
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 />