开发者

Help with HTML Button and PHP [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit 开发者_StackOverflowthe help center. Closed 11 years ago.

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜