Note that there are some explanatory texts on larger screens.

plurals
  1. POsend data on button click from javascript to database
    primarykey
    data
    text
    <p>So I have a php page that gets data from database and displays a table. Each td symbolises a seat in a movie theater. What i want to do is when a user clicks on one or more tds, and clicks send, the status column for each td in the database changes to 1 from 0(default). When the database is accessed next time, the td's with status=1 have a different color. My code upto now is:</p> <pre><code> &lt;div id="screen"&gt;SCREEN&lt;/div&gt; &lt;div id="Seatings"&gt; &lt;?php echo "&lt;table border='1'&gt; &lt;tr&gt; &lt;th&gt;Seating&lt;/th&gt; &lt;/tr&gt;"; $count=0; echo "&lt;tr&gt;"; echo"&lt;td id='Seat_rn'&gt;A&lt;/td&gt;"; while($row = mysql_fetch_array($sql)) { if($count&lt;10){ echo "&lt;td id='Seat_A' class='count'&gt;" . $row['Seat'] . "&lt;/td&gt;"; } $count++; } echo "&lt;/tr&gt;"; $sql=mysql_query("SELECT * FROM Seating_para_20 Where Seat &gt; '10'"); echo "&lt;tr&gt;"; echo"&lt;td id='Seat_rn'&gt;B&lt;/td&gt;"; while($row = mysql_fetch_array($sql)) { if($count&gt;=10){ echo "&lt;td id='Seat_B' class='count'&gt;" . $row['Seat'] . "&lt;/td&gt;"; } $count++; } echo"&lt;/tr&gt;"; echo "&lt;/table&gt;"; ?&gt; &lt;/div&gt; &lt;input type="button" value="Done" name="done" onclick="window.close()"&gt; </code></pre> <p>My jquery code is:</p> <pre><code> $("td #Seat_A").click(function(){ $(this).css("background", "red"); }); $("td #Seat_B").click(function(){ $(this).css("background", "red"); }); $(document."done").click(function(){ alert(price:750 Baht); }) </code></pre> <p>I am nowhere near what i want and I'm sorry if any of my code is "amatuer-ish" but I am new to this and I have been trying very hard. Would appreciate any help that I can get. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    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