I am working on a project our website designer gave us this code for users to pick their order
<img src="images/product001.png" alt="" />
<h1>Espresso Roast Pods</h1>
<span>Php 999.99</span>
<button>Order</button>
all we need to do is add a php code to it when a user clicks the button it will send the order to the database, do you have any idea how we are going to do it? THanks in advance
Well, first you need to make that there button do something. It has no type attached to it, nor a name. You need both to make the magic happen.
THEN in your PHP script you add a conditional to check if the button in question was what triggered the form processing. For instance, if you named the button btnOrderExpresso
, your conditional would look like this:
if( isset( $_POST['btnOrderExpresso'] ) ) {
# magic here
}
精彩评论