pguetschow
pguetschow

Reputation: 5337

Cancel and Return in PHP

I have a formular, where you can edit a customers data. Below this there are 2 Buttons "Save" and "Cancel". Saving works fine, but if I click the cancel button, it should close the Formular and go back to the last page, which is the customer overview. How do I realize this?

Upvotes: 0

Views: 339

Answers (2)

pguetschow
pguetschow

Reputation: 5337

<input action="action" type="button" value="Cancel" onclick="history.back();" />

Worked perfectly for this. Only had to end the php section and start it behind the funtion again

Upvotes: 0

Voro
Voro

Reputation: 66

You don't need PHP for that, just a bit of Javascript. Try this:
<input action="action" type="button" value="Cancel" onclick="history.back();" />

Upvotes: 1

Related Questions