Page 1 of 1

OnClick

Posted: Wed Mar 05, 2003 11:58 am
by silgol
As I can execute an instruction SQL using onclick?


<input type="hidden" name="q" value>
<input type="submit" value="&laquo" onClick="form.q.value=<?
$result=mysql_db_query("auth","select * from Personal order by Nombre Asc");
?>">
<input type="submit" value="&raquo" onClick="form.q.value=<?
$result=mysql_db_query("auth","select * from Personal order by Nombre Desc");

Posted: Wed Mar 05, 2003 3:24 pm
by kcomer
I don't think that's going to work. PHP is server side not client side. You'd have to call a php page with that code inside of it.

Keith

Posted: Sun Mar 16, 2003 5:47 am
by Gen-ik
.......and also, PHP isn't JavaScript!!

OnClick="" can only trigger JavaScript.

Do something like this..

OnClick="window.location.href=('update.php?VAR=VALUE')" .. and then get the PHP script to send the user back to the page they were on.

However.. you may need to write the JavaScript using PHP to get the variables you want..

Code: Select all

<?php
echo("OnClick="window.location.href=('update.php?VAR=$VALUE')"");
?>

It's a good idea to learn JavaScript & PHP before you start mixing the two together!