Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Problem with php or Jscript ?

$
0
0
Hello i'm trying to realize where i'm doing wrong if any one of u can tell me where i'm wrong i'll be thankfull .

so my problem is i have a button and when i click on that it's working OK but the problem if i reload the page the function excetuciton itself so ...

<script type="text/Javascript" >

function checkout()
  {
 		<?php
			include "database.php";
			$UserID = 0 ;
			$$Types = 1 ;

				if (!$mysqli->query("CALL h_check_out('$id','$ReservationID' , '$Client' , '$RoomNumber' , '$UserID', '$Types')")) 
					{
						echo "CALL failed: (" . $mysqli->errno . ") " . $mysqli->error;
					}
			
		?>
		alert ("Check in realizaed succesfully");
		window.location.reload();
  }
  </script>


<input type="button" id="php_code" onclick="checkout()" value="Checkout"> 




So all is working ok but i want to executee the function just onclick of button not On Refresh of page .... ?
any suggestion or any help ?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>