I have a script

echo "<tr> <td><input type=\"button\" value=\"Печать\" onclick=\"window.location='index_bronirovanie.php?rooms={$b['rooms']}&beds={$b['beds']}&beds_ext={$b['beds_ext']}&price={$b['price']}&price_max={$b['more']}&position=".urlencode($b['position'])."#form'\" /></td> <td height='10'> </td> </tr>"; 

How to make so that when you click on this button was running some of my script?

  • By clicking on this button, the script index_bronirovanie.php , and the parameters are passed to it via $_GET . If you want your script to run, index_bronirovanie.php it in index_bronirovanie.php . Or, give clarification on the issue. - Max
  • and how to execute it without entering into the file index_bronirovanie.php? - Decarti

1 answer 1

If the button is in the form, then on the page with the button you can do this:

Give button attribute name='bronirovanie'

Write condition:

 <? if(isset($_POST['bronirovanie'])){ #ваш код }?> 

Another option would be to use AJAX. Connect the jQuery library, assign an identifier to the button and after pressing the button execute a PHP script that will be written in a separate file.