Hey
I am trying to make it so when the user clicks on one the the restaurant names, the page is filled with its information.
I am having problems with getting arguments to pass. Here’s my code on the bottom. What I am trying to do is have ‘click’; something like that
The problem is, that not even echo ‘<button onclick=“american(“lolol”)”>click’; is working, It should change the title to lolol but nothing. When I just have
echo ‘click’; and in the script something like(script right under this) it works and changes the title to “dew…”, so I don’t understand why it wont pass the argument and change the title.
[php]
function american()
{document.getElementById(“title”).innerHTML=“dewdwedewd”;}
[/php]
[php]<?php
$query = "SELECT title FROM group12db.restaurant WHERE category = 0;";
$result = mysql_query($query);
if (!$result) die("Database access failed".mysql_error());
$rows = mysql_num_rows($result);
for ($j = 0; $j<$rows;++$j){
$row = mysql_fetch_row($result);
$query1 = "SELECT paragraph1 FROM group12db.review WHERE r_id = '%".$j."%';";
$result1 = mysql_query($query1);
$row1 = mysql_fetch_row($result1);
$query2 = "SELECT paragraph2 FROM group12db.review WHERE r_id = '%".$j."%';";
$result2 = mysql_query($query2);
$row2 = mysql_fetch_row($result2);
echo $row[0].'<br />';
//echo $row2[0].'<br />';
echo '<button onclick="american("lolol")">click</button>';
// echo '<input type="button" onclick="alert(\.$row1[0].)"/>';
}
?>[/php]
[code]
[/code]