Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't get buttons to append to textarea
    primarykey
    data
    text
    <p>I'm building a restaurant menu application in PHP &amp; JavaScript And I can't seem to get the buttons to append the text area when the ordering is being placed...(This is just test code at present) Here's my code:</p> <pre><code>$test = mysql_query("SELECT * FROM main_stock"); while($row = mysql_fetch_array($test)){ echo "&lt;div id='".$row["RCode"]."'&gt;&lt;a href='javascript:addTo(".$row["Name"].",".$row["RCode"].")'&gt;".$row["Name"]."&lt;/a&gt;&lt;/div&gt;";} </code></pre> <p>And my javascript function is as follows:</p> <pre><code>function addTo(name, Rcode) { document.getElementById('order').value += name; } </code></pre> <p>And HTML Form is as follows:</p> <pre><code> &lt;form id="OrderForm" name="OrderForm" method="post" action=""&gt; &lt;p&gt; &lt;label&gt; &lt;textarea name="order" id="order" cols="35" rows="20" readonly="readonly"&gt;test&lt;/textarea&gt; &lt;/label&gt; &lt;/p&gt;&lt;table&gt; &lt;tr&gt;&lt;td&gt;Subtotal:&lt;/td&gt;&lt;td&gt;&lt;input type="text" id="subtotal" readonly="readonly" value="2.00" /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Tax:&lt;/td&gt;&lt;td&gt;&lt;input type="text" id="tax" readonly="readonly" value="2.00"/&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Total:&lt;/td&gt;&lt;td&gt;&lt;input type="text" id="total" readonly="readonly" value="4.00"/&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="submit" id="submit" value="Send Order To Kitchen"/&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p></p>
    singulars
    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