By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,349 Members | 1,353 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,349 IT Pros & Developers. It's quick & easy.

getting php to validate xHTML strict

praclarush
P: 27
php version 5.2.5

well hereís the problem, I have this home work for a class, in it we just had to copy things out of the book as they have it and follow along basically. Then the teacher add extra things onto it, one of them is to make sure everything validates xHTML strict. Thatís fine except I can't get this small piece of code to validate, can anyone offer a little help. Iím new to the whole php thing.

[PHP]<p><input type="text" name="number" size="20" value="<?php if (!empty($_GET['number'])) echo $_GET['number'] ?>" /></p>[/PHP]

the validation page works if you get rid of the ">" but then the whole script stops working
Feb 20 '08 #1
Share this Question
Share on Google+
2 Replies


dlite922
Expert 100+
P: 1,584
php version 5.2.5

well hereís the problem, I have this home work for a class, in it we just had to copy things out of the book as they have it and follow along basically. Then the teacher add extra things onto it, one of them is to make sure everything validates xHTML strict. Thatís fine except I can't get this small piece of code to validate, can anyone offer a little help. Iím new to the whole php thing.

[PHP]<p><input type="text" name="number" size="20" value="<?php if (!empty($_GET['number'])) echo $_GET['number'] ?>" /></p>[/PHP]

the validation page works if you get rid of the ">" but then the whole script stops working
you dont' validate the code from the server (with php code in it) you validate the RESULT of the page.

i.e. do a view source, copy and paste that into your XHTML validator.

XHTML means everything has to be in valid XML style.

XML style is

<tagname attributename="value">content aslkdfalskd</tagnam>

or

<tagname />
Feb 20 '08 #2

praclarush
P: 27
you dont' validate the code from the server (with php code in it) you validate the RESULT of the page.

i.e. do a view source, copy and paste that into your XHTML validator.

XHTML means everything has to be in valid XML style.

XML style is

<tagname attributename="value">content aslkdfalskd</tagnam>

or

<tagname />
Thanks for the help, sorry I didn't post earler,
praclarush
Feb 21 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.