Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. <form action="mode.php" method="POST">
  2. <input style="background-color: green;" id="home" name="home" type="submit" value="HOME"></br>
  3. <input style="background-color: red;" id="away" name="away" type="submit" value="AWAY">
  4. </form>
  5.  
  6. <?php
  7.  
  8. $dbhost = 'localhost:3036';
  9. $dbuser = 'xxx';
  10. $dbpass = 'abc1234';
  11. $conn = mysql_connect($dbhost, $dbuser, $dbpass);
  12.  
  13. if(! $conn ) {
  14. die('Could not connect: ' . mysql_error());
  15. }
  16. if (isset($_POST['home'])) {
  17. $sql= insert into home_mode (id, status) value (null, "HOME");
  18.  
  19. mysql_select_db('home_mode');
  20.  
  21. $retval = mysql_query( $sql, $conn );
  22. if(! $retval ) {
  23. die('Could not enter data: ' . mysql_error());
  24. }
  25.  
  26. echo "Mode changed to HOME";}
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement