This question is an HTML/php mix…
I am designing a screen which is basically an HTML form. It’s the first one I have done, but it seems OK. As part of the form I want to have a cancel button which will take the user back to the home page.
While researching how best to code the form I have seen at least 3 different strategies for handling this type of navigation.
Option 1: A form submit button, with associated php handling….
<input type=’submit’ name=’cancel’ value=’Cancel’ />
// php handling…..
if (array_key_exists(“cancel”, $_POST)) {
header(‘Location: home.php’ );
exit;
}
Option 2: A standard form button
<input type=’button’ name=cancel2′ value=’Cancel2′
onclick=”window.location.href=’home.php'”>
Option 3: Use an href – the button will be an image, so this sould be fine too
The question is which of these should be the preferred solution in a php/html/css web app.
Does it just come down to preference or are there some situations in which an option will not perform well in terms of security, performance, ease of css styling, maintainability etc…