php - how to use button as a link? -


can show me how use html button link connect php? i'm not quite sure how , can't find useful code can me achieve it. i'm pretty new bit struggling it.thanks

http://i.stack.imgur.com/ydhen.jpg

[![<!doctype html> <html> <head> <meta charset="utf-8"> <style> h1 {     padding-top: 50px;     text-align: center;     color: white;     margin-right:60px; } </style>     <title> washing machine control system</title>     <link rel="stylesheet" type="text/css" href="bk.css"/>     <link rel="stylesheet" type="text/css" href="machinebuttons.css"/>     <script src="http://code.jquery.com-1.11.3.min.js"></script> </head>  <body bgcolor = "black">    <h1>machine controller</h1>      <br></br>     <br></br>    <form method="get/post" action="thenameofmyphpfile.php">  <div id="icons"><img src="d:\year 4 (sem1&2)\mobile technologies\coursework\website\wm1.jpg"  alt="machine one" style="width:150px;height:228px;"/></a></div>          <label class="switch">             <input class="switch-input" type="checkbox" />             <span class="switch-label" data-on="m1 on" data-off="m1 off"></span> <span class="switch-handle"></span>          </label>  <div id="icons2"><img src="d:\year 4 (sem1&2)\mobile technologies\coursework\website\wm2.jpg" alt="machine two" style="width:150px;height:228px;"/></a></div>          <label class="switch">             <input class="switch-input" type="checkbox" />             <span class="switch-label" data-on="m2 on" data-off="m2 off"></span> <span class="switch-handle"></span>          </label>  <div id="icons4"><img src="d:\year 4 (sem1&2)\mobile technologies\coursework\website\wm3.jpg"  alt="machine three" style="width:150px;height:228px;"/></a></div>         <label class="switch">             <input class="switch-input" type="checkbox" />             <span class="switch-label" data-on="m3 on" data-off="m3 off"></span> <span class="switch-handle"></span>          </label>  <div id="icons3"><img src="d:\year 4 (sem1&2)\mobile technologies\coursework\website\wm4.jpg" alt="machine four" style="width:150px;height:228px;"/></a></div>          <label class="switch">             <input class="switch-input" type="checkbox" />             <span class="switch-label" data-on="m4 on" data-off="m4 off"></span> <span class="switch-handle"></span>          </label> </form>      </body> </html>] 

while these answers button, not show how 'connect' php. in order have button fire php code, must put in form , set form's action php script. then, when form submitted, post data php script specified. so:

html:

<form action="myscript.php">     <input type="submit" name="onbutton" value="on" />     <input type="submit" name="offbutton" value="off" /> </form> 

php:

<?php  if (isset($_post['onbutton'])) {     echo "on button pressed."; } else if (isset($_post['offbutton']){     echo "off button pressed."; } ?> 

Comments

Popular posts from this blog

r - how do you merge two data frames the best way? -

How to debug "expected android.widget.TextView but found java.lang.string" in Android? -

php - mySQL problems with this code? -