Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to combine xhtml form with php codes?
    primarykey
    data
    text
    <p>this might be little confusing but i need to combine xhtml form with php codes. so here how it began: i created a search box and user searches for a product by typing a keyword or title and then my search page searches for the data from mysql and display the information in a table format. now my webpage suppose to compare the product information if from the displayed table if the user tick specific two rows of the result table and submit that again then it will take them to another web page where those two ticked product's price would be compared. i don't know exactly how i would do that so your suggestion would help me out. </p> <pre><code>echo "&lt;table border='1' bordercolor='#000066'&gt; </code></pre> <p></p> <pre><code> &lt;th&gt;Item&lt;/th&gt;&lt;br /&gt; &lt;th&gt;image&lt;/th&gt; &lt;th&gt;description&lt;/th&gt; &lt;th&gt;price&lt;/th&gt; &lt;th&gt;brand&lt;/th&gt; &lt;th&gt;store&lt;/th&gt; &lt;th&gt;Tick&lt;/th&gt; &lt;/tr&gt;"; // setting up the table headings. while ($query_row=mysql_fetch_assoc($query_run)) { echo "&lt;tr bgcolor='#F5FFFF'&gt;"; echo "&lt;td&gt;". $query_row['title']. "&lt;/td&gt;"; echo "&lt;td&gt;&lt;img HEIGHT='250' WIDTH='250' src=fetch.php?imageid=".$query_row['productid']."&gt;&lt;/td&gt;"; echo "&lt;td&gt;". $query_row['description']."&lt;/td&gt;"; echo "&lt;td&gt;"."£".$query_row['price']. "&lt;/td&gt;"; echo "&lt;td&gt;". $query_row['brand']."&lt;/td&gt;"; echo "&lt;td&gt;&lt;a href=".$query_row['store']."&gt;Click here&lt;/a&gt;&lt;/td&gt;"; echo '&lt;td&gt;'; ?&gt; &lt;form action="tick.php" method="post"&gt; &lt;br /&gt; &lt;input type="checkbox" name="compare" value="&lt;?php echo $query_row['productid']?&gt;" /&gt;select to compare&lt;br /&gt; &lt;?php echo '&lt;/td&gt;'; } echo "&lt;/table&gt;"; ?&gt; &lt;input align="right"type="submit" name="formSubmit" value="Click to comapre" /&gt; &lt;/form&gt; </code></pre> <p>the following code for </p> <p>tick.php </p> <pre><code>&lt;?php </code></pre> <p>$compare = $_POST['compare'];</p> <p>if(empty($compare )) {</p> <pre><code>echo("You didn't select any products."); </code></pre> <p>} else { $N = count($compare);</p> <pre><code> echo("You selected $N product: "); for($i=0; $i &lt; $N; $i++) { echo($compare[$i] . " "); } </code></pre> <p>}</p> <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