help with creating button in php

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]

You can try this, I have tested and it works fine!

[php]

<?php echo 'click'; ?>[/php]

hey thank you, would I do the same way if I wanted to put a variable instead of having ‘lolol’ say i want it to be
echo ‘click’;

do like this:
[php]echo ‘click’;[/php]

thanks man that worked, weird thing is that not all the buttons work lol o well thxs

Sponsor our Newsletter | Privacy Policy | Terms of Service