Search This Blog

Saturday 31 October 2015

Get a date after 10 days from current date in PHP.

<?php

 echo date('M d, Y', strtotime('+10 days') );

?>

Sunday 4 October 2015

Update check box value into database using php.

<?php

if(isset($_POST['submit']))

{

mysql_query("update tablename set clname=value where clname=value");
}
?>
<table>
<tr>
<td><form method="post" action="">

<input type="checkbox" name="name" value="1"<?php if($data['name'] == '1') echo 'checked'; ?>/>

<input type="submit" name="submit" >

</form></td></tr>

</table>

Delete multiple rows from mysql with checkbox in php.

if(isset($_POST['Submit']))

{

foreach($_POST['check'] as $val1)
{
mysql_query("delete from tablename where id=".$val1."");

}

}

?>

<?php

$rec=mysql_query("select * from table name");

while($row=mysql_fetch_array($rec))

{

?>

<input type="checkbox" name="check[]" value="<?php echo $row['id'];?>" />

<?php }?>

<input type="submit" name="Submit" value="Delete" />