My HTML code:
<p>NEWS</p>
<p>
<form action="news.php" method="post"> <center><input name="NEW" type="submit"
id="new" value="NEW"/>
<input name="Modify" type="submit" id="Modify2" value="Modify" />
</form>
</p>
news.php
<?php //Main function
$event=$_POST;
if($event=='NEW')
post_new(); //already defined
else if($event=='Modify')
modify();//already defined
?>
post_new() and Modify() are already defined in the document.
What I intend to do is check which button has been clicked on the first page and invoke the functions accordingly but I don’t know where I am wrong because its not working. Please help, thanks in advance.. 🙂
$event (and $_POST) is an array. Use it like this: