Note that there are some explanatory texts on larger screens.

plurals
  1. POMore than one submit button
    primarykey
    data
    text
    <p>I'm having trouble with more then one submit Buttons in HTML &amp; PHP, i tried to code a GUI for a web-based calculator. That's realy easy, but the function in php isn't so easy. So i have this simple GUI with 6 submit buttons:</p> <pre><code>&lt;?php $output= isset($_POST['output']) ? $_POST['output'] : ""; function calc(){ //calculate... } ?&gt; &lt;!DOCTYPE html&gt; &lt;html lang="de"&gt; &lt;head&gt; &lt;meta charset="utf-8" /&gt; &lt;title&gt;Calc&lt;/title&gt; &lt;style type="text/css"&gt; .bwidth { width: 100%; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="calc.php"&gt; &lt;h1&gt; &lt;u&gt;MY Own Calculator&lt;/u&gt; &lt;/h1&gt; &lt;table border="3px" type="box" cellspacing="5px" width="250px"&gt; &lt;tr style="height: 24px;"&gt; &lt;td colspan="3"&gt;&lt;input type="text" name="&lt;?php $ausgabe ?&gt;" value="0" style="width: 98%;" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input class="bwidth" type="submit" name="1" value="1" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input class="bwidth" type="submit" name="2" value="2" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input class="bwidth" type="submit" name="3" value="3" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&lt;input class="bwidth" type="submit" name="minus" value="-" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input class="bwidth" type="submit" name="plus" value="+" /&gt;&lt;/td&gt; &lt;td&gt;&lt;input class="bwidth" type="submit" name="enter" value="=" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/form&gt; &lt;/body&gt; </code></pre> <p>Now how I can differentiate these many submit buttons? It's even possible to have more than one submit button? I tried it to seperate the buttons by the value... but it didn't work.</p> <p>And sb has an idea how i can add a value to an existing value in the textfield? So i can push button 1 and it will write 1 in the textfield and when i will push button 2 it will add the number 2 so it will a "12"?</p> <p>Thanks for all suggestions!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload