bhardin
01-08-2008, 09:11 PM
Hello,
Can anyone steer me on a correct conceptual path for initiating a database query (a save from a temporary table to a permanent one) from the click of an HTML button? The only change I want on my page is for the button to disable after the query.
I present the code below in a storybook fashion for what I am trying to accomplish, and not in any serious way:
<!--
This navigation button appears on 4 different pages.
It is an include file on these 4 pages, and the query
should be able to be initiated only once from any of them.
-->
<table align="center">
<tr>
<td height="80px"></td>
</tr>
<tr>
<td><input type="button" name="save" value="Save"
onclick= <!-- perform the query below -->
<?php
if (isset($id)) {
require_once ('../mysql_connect.php');
$query = "INSERT INTO table_permanent
SELECT NULL, first_name, last_name
FROM table_temporary
WHERE id=$id";
mysql_query($query, $dbc);
}
?>
<!-- After the query, the button should disable -->
</td>
</tr>
</table>
Thank you,
Conceptually Challenged Bill :confused:
Can anyone steer me on a correct conceptual path for initiating a database query (a save from a temporary table to a permanent one) from the click of an HTML button? The only change I want on my page is for the button to disable after the query.
I present the code below in a storybook fashion for what I am trying to accomplish, and not in any serious way:
<!--
This navigation button appears on 4 different pages.
It is an include file on these 4 pages, and the query
should be able to be initiated only once from any of them.
-->
<table align="center">
<tr>
<td height="80px"></td>
</tr>
<tr>
<td><input type="button" name="save" value="Save"
onclick= <!-- perform the query below -->
<?php
if (isset($id)) {
require_once ('../mysql_connect.php');
$query = "INSERT INTO table_permanent
SELECT NULL, first_name, last_name
FROM table_temporary
WHERE id=$id";
mysql_query($query, $dbc);
}
?>
<!-- After the query, the button should disable -->
</td>
</tr>
</table>
Thank you,
Conceptually Challenged Bill :confused: