Ok, so I have a reservation system I'm working on, and I have events created in a table that is populated by PHP if the administrator adds new events. I would like to run a script if the user is trying to write an event and then submit the form to php. I would like to do this because I want to find out if the user has a voucher and wants to pay by card or via paypal.
Here is a screenshot of the table, sorry only for the link, I need 10 reputation points.

PHP code that creates the tables:
<?php
$con = mysql_connect("localhost","root","");
if(!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("flexiflash", $con);
echo "<thead>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>Venue</th>";
echo "<th>Event</th>";
echo "<th>Date</th>";
echo "<th>Time</th>";
echo "<th></th>";
echo "</tr>";
echo "</thead>";
$result = mysql_query("SELECT * FROM events");
while($row = mysql_fetch_array($result))
{
echo "<tbody>";
echo "<form class='table-form' action='book_event.php' method='post' onsubmit='return check()'>";
echo "<tr>";
echo "<td>" . $row['Event_ID'] . "</td>";
echo "<td>" . $row['Event_Venue'] . "</td>";
echo "<td>" . $row['Event_Name'] . "</td>";
echo "<td>" . $row['Event_Date'] . "</td>";
echo "<td>" . $row['Event_Time'] . "</td>";
echo "<td><input type='submit' class='sub_btn' name='submit' value='Book now'></td>";
echo "</tr>";
echo "</form>";
echo "</tbody>";
}
mysql_close($con);
?>
IF YOU NEED ANY MORE INFORMATION TO LET ME KNOW
source
share