OnClick

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
silgol
Forum Newbie
Posts: 11
Joined: Fri Jan 24, 2003 1:31 pm

OnClick

Post 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");
kcomer
Forum Contributor
Posts: 108
Joined: Tue Aug 27, 2002 8:50 am

Post 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
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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!
Post Reply