Reputation: 18103
I have this
<form action="profiles.php" method="POST" name="SearchAdvanced" id="SearchAdvanced">
<a style="display: inline-block; width: 100px; font-weight: bold; cursor: pointer;" id="submitSearchAdvanced">Sök </a>
<script>
$('#submitSearchAdvanced').click(function() {
javascript:document.SearchAdvanced.submit();
});
</script>
</form>
How should i call it? should i do if($_POST["SearchAdvanced"])
Upvotes: 0
Views: 140
Reputation: 13798
If what you posted is the entire form, you don't need to submit it using POST, because you are not altering a resource on the server. Instead, you should remove the form and leave only the link - and maybe style it using CSS like you did.
Upvotes: 0
Reputation: 853
Besides checking request method, you can also do a check for variable being set in POST:
isset($_POST['SearchAdvanced'])
Offtopic: Also, "pro" tip: never uset double quotes ( " ) if you do not have variable definition in it.. There is a difference between single and double quotes in PHP. http://www.php.net/manual/en/language.types.string.php
Upvotes: 0
Reputation: 239402
Check $_SERVER['REQUEST_METHOD']
, which will be "GET"
or "POST"
.
The manual page for $_SERVER
describes the indices in detail.
Upvotes: 1