Wednesday 15 May 2013

Retrieve data from MySQL Database on button click with PHP -


Then I have an HTML table with each of my competition names, dates and every row of the table, which is a button competition What is the name I want to know, if it is possible to show the results of that contest when the button is clicked? The results of each competition are credited to the competition names and dates in a separate table in the database.

In the minute my table looks like this

  echo "
Tr> compete number <28> Th & gt; ; Competitive Name & lt; / th & gt; & lt; th & gt; Date of Contest & lt; / th> gt; Results & lt; / th & gt; & lt; / tr & gt; "; While ($ line = mysql_fetch_array ($ result)) {resonant "<" align = 'center'> & lt; td & gt; " $ Line ['contest id']. "& Lt; / td> & lt; td & gt; $ Line ['competitiveness]]] "& Lt; / td> & lt; td & gt; Date ("D / M / Y", Stratomem ($ line ['start date']). "& Lt; / td> & lt; td & gt; & lt; a href = results.php? Id = ". $ Line ['contest id']. & Gt; Results & lt; / a & gt; & lt; / td & gt; & lt; / td & gt; & lt; / tr & gt;";} Echo "

What am I trying to achieve, when I click on a button which Competition, it will show a model on the page that shows the results of that contest.

This is the format of your & lt; input & gt; tag at the string string delimiter you are using in PHP, not the quotation in the tag. Type two attributes have no quotes:

   type = 'submit' value = PGA id = 6>  

It is better to add quotation and strip to spaces:

  & quot; input type = 'submit' value = 'PGA' id = '6' & gt;   

You have edited the code to include an attribute of value = value = , which I think is just an editing mistake.

If you want to read a value from the form on the basis of competition PK, then you can do something like this:

  & lt; Input type = 'submit' name = "competition [6]" value = 'PGA' id = '6' & gt;  

You can see which contest was clicked (this would be an array)

$ _ POST ['Contest'] . P>

No comments:

Post a Comment