Thursday, 17 May 2012

A method to make one click buttons in php

Here is a method to make buttons which will disabled automatically after click. This is useful when you dealing with php scripts.There also other methods for this. Here is only the logic not complete code.

<?php
mysql_select_db("sample", $p);
$z1=$z2=0;
$r=mysql_query("SELECT * FROM sampletable");

while($rows=mysql_fetch_array($r))
{
$take=$rows['samples2'];


if($take=='a1')
$z1=1;
if($take=='a2')
$z2=1;
}

if($z1==1)
echo "<input type='submit' value='a1'  name='opt' disabled >";
else
echo "<input type='submit' value='a1'  name='opt' >";




if($z2==1)
echo "<input type='submit' value='a2'  name='opt' disabled >";
else
echo "<input type='submit' value='a2'  name='opt'>";


mysql_close($p);

?>







0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More