manan
manan

Reputation: 9

add insert,retrieve,update and delete in one php form

How to add insert, retrieve, update and delete in one php form? My form's page name is registration1.php and if i want to insert then

action=registration.php

But if i want 4 button together then how can i?

Upvotes: 1

Views: 1565

Answers (1)

Bram
Bram

Reputation: 1112

Simply add 4 submit buttons to your form, in your PHP code, check which one was pressed.

<form action="" method="post">
<input type="text" name="text" value="testing" />
<input type="submit" name="login" value="log in" />
<input type="submit" name="delete" value="delete" />
<input type="submit" name="update" value="time to update" />

Clicking on a button will result in a $_POST array that looks like

Array ( [text] => testing [update] => time to update ) // clicked update button, see no loging or delete buttons.

Upvotes: 3

Related Questions