alin19 Posted February 2, 2008 Share Posted February 2, 2008 can i use something like this, but in stead of javascript to use php? <html> <script language="javascript" type="text/javascript"> <!-- function test() { with (document.forms.form1) { reset.disabled=false } } --> </script> <body> <form action="" method="POST" name="form1"> <input type="text" name="nume" value="nume" onchange="test()"> <input type="submit" name="submit" value="submit" onmouseover="test()"> <input type="reset" name="reset" value="reset" disabled=true> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
PHPoracle Posted February 2, 2008 Share Posted February 2, 2008 <form action="" method="POST" onSubmit="" name="form1"> Your forgetting the OnSubmit... Quote Link to comment Share on other sites More sharing options...
papaface Posted February 2, 2008 Share Posted February 2, 2008 You can't do what you're trying to do with Javascript with PHP. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted February 2, 2008 Share Posted February 2, 2008 NO... PHP runs on the server not the client. Quote Link to comment Share on other sites More sharing options...
alin19 Posted February 2, 2008 Author Share Posted February 2, 2008 ok, i understand, but let's say that i get in a php array all the the ements from a table of mysql, can i pass them into a javascript array to use them later with what client does? Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted February 2, 2008 Share Posted February 2, 2008 Yeah, something like this: <script type="text/javascript"> <?php $sql = mysql_query("SELECT * FROM table"); $i = 0; while($row = mysql_fetch_array($sql)){ echo 'var myVar'.$i.' = "'.$row['fieldName'].'";'; $i++; } ?> </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.