javascript - Using a HTML button to call and pass information to a PHP function -
javascript - Using a HTML button to call and pass information to a PHP function -
i have next code in trying display info sql database, print , have button next info allow me phone call php function. aware can not phone call php function html php server side. of other answers seem assume knowledge of ajax/ javascript not have. code follows:
while ($row = $results->fetcharray()){ /* homecoming results */ $links .= 'website name: '. $row['title'].'<br>'; $links .= "link : <a href= " . $row['link'] . " > " . $row['link'] ." </a> </br>"; $links .= "recommendations: " . $row['recommendations'] . "</br></br>"; } homecoming $links;
i add together each bit of information, pre formatted, $links
variable , homecoming accessed in different file. originally, thought able similar
$links .= 'website name: '. $row['title'].'<button onclick="recommend($row[id])" /><br>';
however requires javascript function recommend
called , not have knowledge of javascript. reason, can think of no other way of solving problem. sorry if have not explained issue plenty , happy provide info may want. give thanks in advance help.
here's non-ajax reply you.
while ($row = $results->fetcharray()){ /* homecoming results */ $links .= 'website name: '. $row['title'].'<br>'; $links .= "link : <a href= " . $row['link'] . " > " . $row['link'] ." </a> </br>"; $links .= "recommendations: " . $row['recommendations'] . "</br></br>"; $links .= "<a href='update.php?id=" . $row['id'] . "'> recommend </a>"; } homecoming $links;
then on update.php add together code process id $_get array , redirect original page.
that way can stick php , not worry ajax/javascript
javascript php html ajax
Comments
Post a Comment