Determining whether or not a button was clicked in php?

Hey...so i have a form...with a bunch of fields, and TWO buttons. One is the over all submit button (hit that and data goes into the sql databsae)...the other one triggers an event.

here is the line of code for the button:

<td colspan="0"><input type="submit" name="projInfo" value="Get Project Info" /></td></tr>

The problem is ... when it is of type "submit", when it is pressed, it executes the operation (using if(isset($_POST['projInfo'])) { ) ... but it clears the whole form...which is kind of annoying..

is there not a way to make the input type = "button" ?? if so, what do i put in place of if(isset($_POST['projInfo'])) { ?

Hope this makes sense :)

Thanks
ps, i know that I can just do

$ProjectID=$_POST['ProjectID'];
$Name=$_POST['Name'];
$Date=$_POST['Date'];
$Hours=$_POST['Hours'];
$Phase=$_POST['Phase'];
$Description=$_POST['Description'];

<script type="text/javascript">
function ChangeMe(){
document.form1.ProjectID.value = "<?php echo $ProjectID;?>";
document.form1.Name.value = "<?php echo $Name;?>";
document.form1.Date.value = "<?php echo $Date;?>";
document.form1.Hours.value = "<?php echo $Hours;?>";
document.form1.Phase.value = "<?php echo $Phase;?>";
document.form1.Description.value = "<?php echo $Description;?>";

document.form1.ProjectName.value = "<?php echo $NameRow[0];?>";
document.form1.Client.value = "<?php echo $ClientRow[0];?>";
document.form1.Type.value = "<?php echo $TypeRow[0];?>";
}

</script>

If i use a "submit" button, but it seems like there is a much easier way :)
 
Back
Top