开发者

HTML Button not working for calling PHP file

I have created a php file which has the following piece of code. The form calls the process-simple-search.php file to process the keyword entered by the user. I am using MAMP and the files are stored as expected in the MAMP folder. The click开发者_StackOverflow of the button however doesn't do anything, I have tried everything but no results...do you have any suggestion?

 <form method="GET" action="process-simple-search.php">
  <fieldset id="general-search">
   <label>Please insert the desired keyword:</label>
   <div id="components">    
    <select name="items">
     <option value="dogs">Dogs</option>
     <option value="cats">Cats</option>
     <option value="rhinos">Rhinos</option>
    </select>
    <input id="textfield" type="text" name="text" value="" size="42"></input>
    <input id="button" type="button" name="button" value="Search"></input>
   </div>
</fieldset>
</form>      


change your button type to submit

 <form method="GET" action="process-simple-search.php">
  <fieldset id="general-search">
   <label>Please insert the desired keyword:</label>
   <div id="components">    
    <select name="items">
     <option value="dogs">Dogs</option>
     <option value="cats">Cats</option>
     <option value="rhinos">Rhinos</option>
    </select>
    <input id="textfield" type="text" name="text" value="" size="42"></input>
    <input id="button" type="submit" name="button" value="Search"></input>
   </div>
</fieldset>
</form>    


You're using the HTML input button. You should be using the submit button one instead, so that it will submit the form.

Try this

<input id="button" type="submit" name="button" value="Search"></input>


You need to change the type of the button to "submit":

<input id="button" type="submit" name="button" value="Search"/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜