Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.
All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!
<?php
$username = $_REQUEST['username'];
$password = $_REQUEST['password'];
$login = isset($_POST['login']) ? $_POST['login'] : '';
function user_valid($username, $password)
{
global $users;
$users = array(
"maver" => "maver",
"pogi" => "pogi",
"nice" => "nice",
"super" => "super",
"lala" => "lala",
);
foreach ($users as $key => $value) /* fetch the array users not the username. */
{
if ($key == $username && $value == $password) /* Added condition if username is a valid user and has valid password. */
{
return true;
}
else
{
return false;
}
}
} /* Missing }. */
?>
<?php
$con=mysql_connect('localhost','root','');
mysql_select_db('dblib',$con);
if(isset($_POST['submit'])){
$qstring="select * from bookrecords";
$result=mysql_query($qstring);
}
else{
$qstring="select * from bookrecords";
$result=mysql_query($qstring);
}
?>
<html>
<title>Library Circulation System</title>
<style type="text/css">
hr
{
color:SpringGreen;
height:2;
width:100%;
}
a
{
font-size:12pt;
text-decoration:none;
}
.class1 a:link
{
color:white;
text-align:center;
font-family:Arial Black;
font-size:11pt;
border:2px outset gold;
zoom:1.1;
color:0;
width:50;
height:30;
background-color:#FFD700;
}
.class1 a:visited
{
color:0;
text-align:center;
}
.class1 a:hover
{
font-family:Arial Black;
font-size:11pt;
border:2px outset gold;
zoom:1.1;
color:0;
width:50;
height:30;
background-color:cyan;
cursor: url(cursor.ani);
}
.class2 a:link
{
font-family:Hobo std;
color:snow;
border:2px outset green;
}
.class2 a:visited
{
font-family:Hobo std;
color:snow;
}
.class2 a:hover
{
font-family:hobo std;
font-size:12pt;
color:cyan;
cursor: url(cursor.ani);
}
h1
{
font-family:Hobo std;
text-align:center;
color:snow;
font-size:25px;
}
td
{
font-family:comic sans ms;
color:snow;
font-size:8pt;
text-align:center;
line-height:150%;
font-style:thinner;
}
body
{
background-color:black;
background-attachment:fixed;
background-position:center;
background-repeat:no-repeat;
scrollbar-arrow-color:red;
scrollbar-base-color:#FF6347;
scrollbar-darkshadow-color:#006600;
scrollbar-face-color:#FFF0F5;
scrollbar-highlight-color:#1E90FF;
cursor:url(sjcb.ani);
}
</style>
<body><span class=1>
<table height=100% width=100% cellpadding=0 cellspacing=0 bordercolor=white borderstyle=double align="center">
<tr>
<td valign=top><h1><br><form method="POST">
BOOK RECORDS</h1><input type="submit" name="submit" value="View" STYLE="font-size:15; background-color:green; color:white; border-color=red">
</form><hr><br>
<table border ="1" width=100% align=center valign="top">
<tr align=center valign=top>
<td>Select</td>
<td>ISBN</td>
<td>Author</td>
<td>Title</td>
<td>Copyright</td>
<td>Location</td>
<td>No. of Books</td>
<td>Date of Purchase</td>
</tr>
<?php
while($row=mysql_fetch_assoc($result)){
?>
<tr align=center>
<td><input type="checkbox" id="check1" /></td>
<td><?php echo $row['ISBN']; ?></td>
<td><?php echo $row['Author']; ?></td>
<td><?php echo $row['Title']; ?></td>
<td><?php echo $row['Copyright']; ?></td>
<td><?php echo $row['Location']; ?></td>
<td><?php echo $row['No.ofBooks']; ?></td>
<td><?php echo $row['Dateofpurchase']; ?></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table><center>
<span class="class2">
<a href="ADD.php" class=2>ADD</a>
</span>
<input type="submit" name="submit" value="EDIT" STYLE="font-size:15; background-color:green; color:white; border-color=red">
<input type="submit" name="submit" value="DELETE" STYLE="font-size:15; background-color:green; color:white; border-color=red">
<center>
</body>
</html>
<td><input type="checkbox" id="check1" /></td>
<td><input type="checkbox" name="myCheckBox[]" id="check1" value="<?php echo $row["ISBN"]; ?>" /></td>
if (isset($_POST["submit"]))
{
$checkBoxes = $_POST["myCheckBox"];
var_dump($checkBoxes); /* Only checked boxes should be dumped. */
if ($_POST["submit"] == "EDIT")
{
$query = mysql_query("UPDATE bookrecords SET (field1, field2) = ('value1', 'value2') WHERE ISBN IN ('" . implode("', '", $checkBoxes) . "')");
}
elseif ($_POST["submit"] == "DELETE")
{
$query = mysql_query("DELETE FROM bookrecords WHERE ISBN IN ('" . implode("', '", $checkBoxes) . "')");
}
}
else
{
/* No submission done code in here. */
}
<html>
<head>
<title>Your Fav Artist!</title>
</head>
<body>
<?php
//checking for submit (first isset)
if (!isset($_POST['submit'])) {
//display form
?>
<form action = "<?php echo $_SERVER['PHP_SELF']; ?>" method = "POST">
<input type="checkbox" name="artist[]" value="Bon Jovi">Bon Jovi<br />
<input type="checkbox" name="artist[]" value="N Sync">N Sync<br />
<input type="checkbox" name="artist[]" value="Boyzone">Boyzone<br />
<input type="checkbox" name="artist[]" value="Britney Spears">Britney Spears<br />
<input type="checkbox" name="artist[]" value="Jethro Tull">Jethro Tull<br />
<input type="checkbox" name="artist[]" value="Crosby, Stills & Nash">Crosby, Stills & Nash<br />
<input type = "submit" name = "submit" value = "select">
</form>
<?php
}
else {
//take the second isset
if (!isset($_POST['artist'])) {
echo "Nothing selected. <br />";
}
else {
echo ‘You selected :<br />’ ;
foreach ($_POST['artist'] as $a) {
echo "<b>$a</b> <br />";
}
}
}
?>
</body>
</html>
hakuna_matata_hm
Create an array name for your checkboxes
intoCode:<td><input type="checkbox" id="check1" /></td>
Dun naman sa PHP.Code:<td><input type="checkbox" name="myCheckBox[]" id="check1" value="<?php echo $row["ISBN"]; ?>" /></td>
Code:if (isset($_POST["submit"])) { $checkBoxes = $_POST["myCheckBox"]; var_dump($checkBoxes); /* Only checked boxes should be dumped. */ if ($_POST["submit"] == "EDIT") { $query = mysql_query("UPDATE bookrecords SET (field1, field2) = ('value1', 'value2') WHERE ISBN IN ('" . implode("', '", $checkBoxes) . "')"); } elseif ($_POST["submit"] == "DELETE") { $query = mysql_query("DELETE FROM bookrecords WHERE ISBN IN ('" . implode("', '", $checkBoxes) . "')"); } } else { /* No submission done code in here. */ }
Edit: You need to put your table into the form, so with the <input type="submit"> tags.
Code:<?php $username = $_REQUEST['username']; $password = $_REQUEST['password']; $login = isset($_POST['login']) ? $_POST['login'] : ''; function user_valid($username, $password) { global $users; $users = array( "maver" => "maver", "pogi" => "pogi", "nice" => "nice", "super" => "super", "lala" => "lala", ); foreach ($users as $key => $value) /* fetch the array users not the username. */ { if ($key == $username && $value == $password) /* Added condition if username is a valid user and has valid password. */ { return true; } else { return false; } } } /* Missing }. */ ?>
<?php
$con=mysql_connect('localhost','root','');
mysql_select_db('dblib',$con);
if(isset($_POST['submit'])){
$checkBoxes = $_POST["myCheckBox"];
var_dump($checkBoxes);
if ($_POST["submit"] == "EDIT")
{
$query = mysql_query("UPDATE bookrecords SET (field1, field2) = ('value1', 'value2') WHERE ISBN IN ('" . implode("', '", $checkBoxes) . "')");
}
elseif ($_POST["submit"] == "DELETE")
{
$query = mysql_query("DELETE FROM bookrecords WHERE ISBN IN ('" . implode("', '", $checkBoxes) . "')");
}
$qstring="select * from bookrecords";
$result=mysql_query($qstring);
}
else{
$qstring="select * from bookrecords";
$result=mysql_query($qstring);
}
?>
<html>
<title>Library Circulation System</title>
<style type="text/css">
hr
{
color:SpringGreen;
height:2;
width:100%;
}
a
{
font-size:12pt;
text-decoration:none;
}
.class1 a:link
{
color:white;
text-align:center;
font-family:Arial Black;
font-size:11pt;
border:2px outset gold;
zoom:1.1;
color:0;
width:50;
height:30;
background-color:#FFD700;
}
.class1 a:visited
{
color:0;
text-align:center;
}
.class1 a:hover
{
font-family:Arial Black;
font-size:11pt;
border:2px outset gold;
zoom:1.1;
color:0;
width:50;
height:30;
background-color:cyan;
cursor: url(cursor.ani);
}
.class2 a:link
{
font-family:Hobo std;
color:snow;
border:2px outset green;
}
.class2 a:visited
{
font-family:Hobo std;
color:snow;
}
.class2 a:hover
{
font-family:hobo std;
font-size:12pt;
color:cyan;
cursor: url(cursor.ani);
}
h1
{
font-family:Hobo std;
text-align:center;
color:snow;
font-size:25px;
}
td
{
font-family:comic sans ms;
color:snow;
font-size:8pt;
text-align:center;
line-height:150%;
font-style:thinner;
}
body
{
background-color:black;
background-attachment:fixed;
background-position:center;
background-repeat:no-repeat;
scrollbar-arrow-color:red;
scrollbar-base-color:#FF6347;
scrollbar-darkshadow-color:#006600;
scrollbar-face-color:#FFF0F5;
scrollbar-highlight-color:#1E90FF;
cursor:url(sjcb.ani);
}
</style>
<body><span class=1>
<table height=100% width=100% cellpadding=0 cellspacing=0 bordercolor=white borderstyle=double align="center">
<tr>
<td valign=top><h1><br><form method="POST">
BOOK RECORDS</h1><input type="submit" name="submit" value="View" STYLE="font-size:15; background-color:green; color:white; border-color=red">
<hr><br>
<table border ="1" width=100% align=center valign="top">
<tr align=center valign=top>
<td>Select</td>
<td>ISBN</td>
<td>Author</td>
<td>Title</td>
<td>Copyright</td>
<td>Location</td>
<td>No. of Books</td>
<td>Date of Purchase</td>
</tr>
<?php
while($row=mysql_fetch_assoc($result)){
?>
<tr align=center>
<td><input type="checkbox" name="myCheckBox[]" id="check1" value="<?php echo $row["ISBN"]; ?>" /></td>
<td><?php echo $row['ISBN']; ?></td>
<td><?php echo $row['Author']; ?></td>
<td><?php echo $row['Title']; ?></td>
<td><?php echo $row['Copyright']; ?></td>
<td><?php echo $row['Location']; ?></td>
<td><?php echo $row['No.ofBooks']; ?></td>
<td><?php echo $row['Dateofpurchase']; ?></td>
</tr>
<?php
}
?>
</table>
</td>
</tr>
</table><center>
<span class="class2">
<a href="ADD.php" class=2>ADD</a>
</span>
<input type="submit" name="submit" value="EDIT" STYLE="font-size:15; background-color:green; color:white; border-color=red">
<input type="submit" name="submit" value="DELETE" STYLE="font-size:15; background-color:green; color:white; border-color=red"></form>
<center>
</body>
</html>
<html>
<head>
<title>Your Fav Artist!</title>
</head>
<body>
<?php
//checking for submit (first isset)
if ( ! isset($_POST['submit']))
{
//display form
?>
<form action = "<?php echo $_SERVER['PHP_SELF']; ?>" method = "POST">
<input type="checkbox" name="artist[]" value="Bon Jovi">Bon Jovi<br />
<input type="checkbox" name="artist[]" value="N Sync">N Sync<br />
<input type="checkbox" name="artist[]" value="Boyzone">Boyzone<br />
<input type="checkbox" name="artist[]" value="Britney Spears">Britney Spears<br />
<input type="checkbox" name="artist[]" value="Jethro Tull">Jethro Tull<br />
<input type="checkbox" name="artist[]" value="Crosby, Stills & Nash">Crosby, Stills & Nash<br />
<input type = "submit" name = "submit" value = "select">
</form>
<?php
}
else
{
//take the second isset
if ( ! isset($_POST['artist']))
{
echo "Nothing selected. <br />";
}
else
{
echo "You selected :<br />"; /* Use ('), (") only. Iba yong character na ginamit mo. */
foreach ($_POST['artist'] as $a)
{
echo "<b>$a</b> <br />";
}
}
}
?>
</body>
</html>
Code:<html> <head> <title>Your Fav Artist!</title> </head> <body> <?php //checking for submit (first isset) if ( ! isset($_POST['submit'])) { //display form ?> <form action = "<?php echo $_SERVER['PHP_SELF']; ?>" method = "POST"> <input type="checkbox" name="artist[]" value="Bon Jovi">Bon Jovi<br /> <input type="checkbox" name="artist[]" value="N Sync">N Sync<br /> <input type="checkbox" name="artist[]" value="Boyzone">Boyzone<br /> <input type="checkbox" name="artist[]" value="Britney Spears">Britney Spears<br /> <input type="checkbox" name="artist[]" value="Jethro Tull">Jethro Tull<br /> <input type="checkbox" name="artist[]" value="Crosby, Stills & Nash">Crosby, Stills & Nash<br /> <input type = "submit" name = "submit" value = "select"> </form> <?php } else { //take the second isset if ( ! isset($_POST['artist'])) { echo "Nothing selected. <br />"; } else { echo "You selected :<br />"; /* Use ('), (") only. Iba yong character na ginamit mo. */ foreach ($_POST['artist'] as $a) { echo "<b>$a</b> <br />"; } } } ?> </body> </html>
pa help naman po ulit, may lumalabas kasi ng codings, ung nakahighlight po sa image attachment ko,
ito po ung code, salamat
Code:<?php $con=mysql_connect('localhost','root',''); mysql_select_db('dblib',$con); if(isset($_POST['submit'])){ $checkBoxes = $_POST["myCheckBox"]; var_dump($checkBoxes); if ($_POST["submit"] == "EDIT") { $query = mysql_query("UPDATE bookrecords SET (field1, field2) = ('value1', 'value2') WHERE ISBN IN ('" . implode("', '", $checkBoxes) . "')"); } elseif ($_POST["submit"] == "DELETE") { $query = mysql_query("DELETE FROM bookrecords WHERE ISBN IN ('" . implode("', '", $checkBoxes) . "')"); } $qstring="select * from bookrecords"; $result=mysql_query($qstring); } else{ $qstring="select * from bookrecords"; $result=mysql_query($qstring); } ?> <html> <title>Library Circulation System</title> <style type="text/css"> hr { color:SpringGreen; height:2; width:100%; } a { font-size:12pt; text-decoration:none; } .class1 a:link { color:white; text-align:center; font-family:Arial Black; font-size:11pt; border:2px outset gold; zoom:1.1; color:0; width:50; height:30; background-color:#FFD700; } .class1 a:visited { color:0; text-align:center; } .class1 a:hover { font-family:Arial Black; font-size:11pt; border:2px outset gold; zoom:1.1; color:0; width:50; height:30; background-color:cyan; cursor: url(cursor.ani); } .class2 a:link { font-family:Hobo std; color:snow; border:2px outset green; } .class2 a:visited { font-family:Hobo std; color:snow; } .class2 a:hover { font-family:hobo std; font-size:12pt; color:cyan; cursor: url(cursor.ani); } h1 { font-family:Hobo std; text-align:center; color:snow; font-size:25px; } td { font-family:comic sans ms; color:snow; font-size:8pt; text-align:center; line-height:150%; font-style:thinner; } body { background-color:black; background-attachment:fixed; background-position:center; background-repeat:no-repeat; scrollbar-arrow-color:red; scrollbar-base-color:#FF6347; scrollbar-darkshadow-color:#006600; scrollbar-face-color:#FFF0F5; scrollbar-highlight-color:#1E90FF; cursor:url(sjcb.ani); } </style> <body><span class=1> <table height=100% width=100% cellpadding=0 cellspacing=0 bordercolor=white borderstyle=double align="center"> <tr> <td valign=top><h1><br><form method="POST"> BOOK RECORDS</h1><input type="submit" name="submit" value="View" STYLE="font-size:15; background-color:green; color:white; border-color=red"> <hr><br> <table border ="1" width=100% align=center valign="top"> <tr align=center valign=top> <td>Select</td> <td>ISBN</td> <td>Author</td> <td>Title</td> <td>Copyright</td> <td>Location</td> <td>No. of Books</td> <td>Date of Purchase</td> </tr> <?php while($row=mysql_fetch_assoc($result)){ ?> <tr align=center> <td><input type="checkbox" name="myCheckBox[]" id="check1" value="<?php echo $row["ISBN"]; ?>" /></td> <td><?php echo $row['ISBN']; ?></td> <td><?php echo $row['Author']; ?></td> <td><?php echo $row['Title']; ?></td> <td><?php echo $row['Copyright']; ?></td> <td><?php echo $row['Location']; ?></td> <td><?php echo $row['No.ofBooks']; ?></td> <td><?php echo $row['Dateofpurchase']; ?></td> </tr> <?php } ?> </table> </td> </tr> </table><center> <span class="class2"> <a href="ADD.php" class=2>ADD</a> </span> <input type="submit" name="submit" value="EDIT" STYLE="font-size:15; background-color:green; color:white; border-color=red"> <input type="submit" name="submit" value="DELETE" STYLE="font-size:15; background-color:green; color:white; border-color=red"></form> <center> </body> </html>