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 Fri Apr 26, 2019 2:32 pm

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: php radio button link
PostPosted: Sat Mar 19, 2016 3:32 am 
Offline

Joined: Tue Jun 16, 2015 1:03 am
Posts: 8
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: Google [Bot] and 11 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:  
cron
Powered by phpBB © 2016 phpBB Group