CodeLobster IDE

Free cross-platform PHP IDE (HTML, PHP, CSS, JavaScript code editor) with support Drupal, Joomla, Twig, JQuery, BackboneJS, LaravelJS, Node.js, Fhalcon, CodeIgniter, CakePHP, Laravel, Magento, MeteorJS, Phalcon, Symfony, VueJS, WordPress, Yii
It is currently Sat Dec 07, 2019 11:11 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: php radio button link
PostPosted: Mon Jul 22, 2019 11:45 pm 
Offline

Joined: Tue May 29, 2018 3:36 am
Posts: 3
Hi, my objective is to list database rows and by clicking one of the
radio buttons in the report, link to the url displayed on that line.
My code follows. I will surely appreciate your input. Thanks
Code:
<!DOCTYPE html><html>
<head><title>Email Visits</title></head>
<body><center>
<form id="testform" name="testform" action="" method="post"
accept-charset="UTF-8">

  <?php
$host="localhost"; $username="root"; $password="cookie";
$db_name="homedb"; $tbl_name="emailtbl";

/* Connect to server and select databse */
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// Define $count
$count = "";

$sql="SELECT * FROM emailtbl ORDER BY target ASC";
$result=mysql_query($sql);

echo '<table border="1" cellspacing="0">';
while($res=mysql_fetch_assoc($result))
{
// Add 1 to the row count
    $count=$count + "1";

/* -------------If $count==1 table row color = FFD4FF ----------*/
    if($count=="1")
    { echo "<tr bgcolor='FFD4FF'>"; }

/* -------------If $count==2 table row color = #ccffff ----------*/
    if($count=="2")
    { echo "<tr bgcolor='ccffff'>"; $count=$count - "2"; }
echo "<td>";

// echo "<input type=\"radio\" name=\"select\"onclick=\"window.open('$res

['target']');\">

echo "<input type=\"radio\" name=\"select\"value=\"{$res['target']}\">";
echo "</td>";
echo "<td>";echo $res['target'];echo "</td>";
echo "<td>";echo $res['username'];echo "</td>";
echo "<td>";echo $res['password'];echo "</td>";
echo "<td>";echo $res['emailused'];echo "</td>";
echo "<td>";echo $res['lastused'];echo "</td>";
echo "<td>";echo $res['purpose'];echo "</td>";
echo "<td>";echo $res['visits'];echo "</td>";
echo "<td>";echo $res['saved'];echo "</td>";

/* echo "</tr>";
}
echo '</table>';
mysql_close();
?>
  </table> </form></body></html>
*/

echo "</tr>" . PHP_EOL;
}
?>
</table></form></body></html>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2016 phpBB Group