I'm using this code to change the include path with javascript:
$('#actionLink').attr('href', $('#actionLink').attr('href') + '?page=welcome');
switch($_GET['page'])) {
case 'welcome':
include 'section/welcome.html';
break;
case 'nda':
include 'section/nda.html';
break;
}
But how do this using a submitbutton?
To show the page URL names on the buttons:
<form method="get" action="<this page's address>">
<input type="submit" name="page" value="page1" />
<input type="submit" name="page" value="page2" />
</form>
Or, to show other text there:
<form method="get" action="<this page's address>">
<input type="submit" name="page" value="Page 1 button text" onclick="this.value='page1'" />
<input type="submit" name="page" value="Page 2 button text" onclick="this.value='page2'" />
</form>
Or lastly, with a hidden field & jQuery:
<form method="get" action="<this page's address>">
<input type="submit" value="Page 1 button text" onclick="$('#hidden').val('page1')" />
<input type="submit" value="Page 2 button text" onclick="$('#hidden').val('page2')" />
<input type="hidden" name="page" id="hidden" />
</form>
$('button').onclick(function() {
$(location).attr('href', 'www.example.com'); //redirect to www.example.com
});
Simply do it in HTML.
<form method="GET" action="?page=whatever">
<input type="submit" value="Click Me!" />
</form>
You can try this:
<form method="POST" action="yourpage.php">
....
<input type="hidden" name="page" id="page" value="welcome">
<input type="submit" value="submit" />
</form>
// $_REQUEST works for both $_GET and $_POST
switch($_REQUEST['page'])) {
case 'welcome':
include 'section/welcome.html';
break;
case 'nda':
include 'section/nda.html';
break;
}
I hope this can be of some help.