I want to use a button to submit a SQL query to a DB using PHP...?

  • Thread starter Thread starter Mokele Mbembe
  • Start date Start date
M

Mokele Mbembe

Guest
I want to use a button to submit a SQL query to a DB using PHP. I could use <form action='submit.php' method='post'>, but I want to run the submit code yet stay on the current page after I submit. Don't give me connection code, I know how to do that.
 
<?
if($_POST['action']=="RunQuery"){
$query = mysql_query("SELECT * FROM DBT WHERE field='$somehting'");
}
else{
<form method="post" action="<? echo $_SERVER['PHP_SELF']; ?>"><input type="hidden" name="action" value="RunQuery">
</form>
}
?>
 
Back
Top