Page 1 of 1

I need to use checkbox which looks like button

Posted: Tue Nov 16, 2010 3:45 am
by ankit.pandeyc012

Code: Select all

<?php
require_once('database.php');
$result=mysqli_query($dbc,"select *from events") or die('Not Connected');
echo "<html>
		<body>";
  echo "<form method='post' action='EventParticipator.php'>"; 
  echo "<table cellspacing='0' cellpadding='15'>
  		<th><b>Event Title:</b></th>
  		<th ><b>Event City:</b></th>
		<th><b>Content:</b></th>
		<th><b>Images:</b></th>
		<th><b>Event Date:</b></th>";
while($row=mysqli_fetch_array($result)){
$Title=$row['Title'];
$City=$row['City'];
$Content=$row['Content'];
//$Photo=$row['Photo'];
$Date=$row['Date'];
$EventId=$row['EventId'];
$Photo=$row['Photo'];
//echo $Photo;
//echo $City;
echo "<tr><td>$Title</td><td>$City</td><td>$Content</td><td><img src='$Photo' width='120' height='90'/></td><td>$Date</td>
	  <td><input type='checkbox' name='event[]' value=$EventId /></td></tr></tr>"; 
}
echo "<tr><td><input type='submit' name='submit' value='Participate'</td>";
echo "<td><a href='log_out.php'>Log out</a></td></tr>";
echo "</table></form></body></html>";
?>



Hi Friends................
In above code I am using checkbox but I want that it looks like just button but act as a checkbox.......
Anyone hvae any idea???????????????
Help me plz......................
Thx in advance.................

Re: I need to use checkbox which looks like button

Posted: Tue Nov 16, 2010 4:08 pm
by thinsoldier
javascript

have a button image with an onclick attribute that calls a javascript function that selects the checkbox next to the image.

Probably also want to use css to position the image over the checkbox widget so you can't see it.