wispas Posted November 19, 2010 Share Posted November 19, 2010 Hi, I have a form on my page. <form id="advanced_search" name="advanced_search" method="POST" action="<?php echo $PHP_SELF;?>"> </form> Form submits with a regular button <input type="submit" name="advSearch" id="advSearch" value="Search" /> And i have a detector to see where submit button has been clicked on my next page: if(isset($_POST['advSearch'])) { echo "Button was clicked"; } However, I wanted a custom button for better styling and control. So i replaced my regular button with this now which uses javascript to submit the form. <a class="button" href="javascript:document.advanced_search.submit()" name="advSearch" id="advSearch"><span>Search</span></a> Now the isset($_POST) is not working anymore. Can anyone help please?? Thanks! Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 19, 2010 Share Posted November 19, 2010 Add a hidden field and check for its value to determine if the form has been submitted. That's technically a better way to do it anyhow. <input type="hidden" name="submitted" value="yes"> if( isset($_POST['submitted']) && $_POST['submitted'] == 'yes' ) { Quote Link to comment Share on other sites More sharing options...
wispas Posted November 19, 2010 Author Share Posted November 19, 2010 Works a treat.. Thanks so much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.