How can I make the form not to run the php code directly when the database.php is executed. I can set an if clause that if isset then run.. but there is nothing in the form except the show button. Is there any way to test if the show button is set? what is the isset for buttons?
below is the code
database.php
<?php
require 'core.inc.php';
require 'conn.inc.php';
if (isset($_SESSION['user_id']) && !empty($_SESSION['user_id']))
{
$query= "SELECT * FROM Properties";
$query_run=mysql_query($query);
if ($num=mysql_num_rows($query_run))
{
echo $num, " results found <br>";
while ($query_row= mysql_fetch_assoc($query_run))
{
echo "Found";
}
}
}
?>
<html>
<div >
<form action='<?php echo $current_file;?>' method='POST'>
<input type="submit" value="Show">
</form>
</div>
</html>
name="showbutton", then you should be able to checkisset($_POST['showbutton'])to see if it was clicked, i.e. the form was submitted