I have the following chunk of code:
while ($row = mysql_fetch_array($result)) {
echo "<li/>".$row['trendName']."<input type='submit' name='Dispay' value='Display All Items' onclick='action='http://blah.co.uk/DisplayData.php';'/>";
echo"<br />";
}
So, this I want to do is for each element on the list to create a button. When I will click at this button I want to hit a URL.
Let’s say that we have only one element on the list (Movies). By clicking on the button next to the movies, I want to move to another URL: http://blah.co.uk/DisplayData.php
and furthermore to pass to the other URL the name of the element (i.e. Movies)
Is this possible, and if so, how?
I would also recommend to use
<button></button>in html 5 to create a button.As suggested above, a link is the proper way to do so.
You can use
$_GET['value'];to retrieve your data “trendName”However “action” is used in the
<form></form>taghere you would use
$_POST['value'];to retrieve your data “trendName”