Text Box Valadiaton

A

Anonymous

Guest
Hi There

I'm new to php, actualy i'm new to everything right know. I have a page where i have the following on it.

Code:
<input type="text" id="password"> 
<input type="button" onclick="if(document.getElementById('password').value=='42323'){window.location='http://www.google.co.uk'}">

is there a way to make this into it's own php script.
 
Yeh, sometimes we need php to print us some code.
You can do (Example):
Code:
<?php

echo '<input type="text" id="password">';
echo '<input type="button" onclick="if(document.getElementById(\'password\').value==\'42323\'){window.location=\'http://www.google.co.uk\'}">';

?>
Ok, i think in this case there´s no need to do this.
Well i mean there are more specific cases we really need to use php on it!

If you´re talking in making that onClick verification in php ... Never!
Php is server-side and all you can do is print the needed javascript code for some client-side verification!
 
Back
Top