Checkebox doesn't hold its value when i use jQuery styling plugin wich allows me to skin form elements. but when i remove the jQuery the code works !!

can someone plz tell me the way to fix it ?!

Code:

<html lang="en-US" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">

<head>
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"/>
<title> Delete Review </title>

<link rel="stylesheet" href="jqtransformplugin/jqtransform.css" type="text/css" media="all" />
<link rel="stylesheet" href="demo.css" type="text/css" media="all" />

<!-- Script for the event handeler -->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.colorize-2.0.0.js"></script>
<script type="text/javascript" src="jqtransformplugin/jquery.jqtransform.js" ></script>


<script language="javascript">
	$(document).ready(function(){
	$('form').jqTransform({imgPath:'jqtransformplugin/img/'});
	});
</script>

<script>

$(document).ready(function(){
 $("#review").colorize( ); 
});
</script>
</head>

<body>

<form action="" method="post"  class = "first" > 
<p align="center"> Welcome to Delete Review Page <br/>Please seclect what you want to delete </p>

<p>

<table  align="center" width="400" border="0" cellspacing="1" cellpadding="0">
<tr background: rgb(236, 246, 252) none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;>
<td><form action="" method="post"  class = "second">

<table id = "review"  width="400" border="0" cellpadding="3" cellspacing="1">

<tr >
<td >&nbsp;</td>
<td colspan="4" align="center" ><strong>Delete Reviews</strong> </td>
</tr>
<tr>
<td align="center" ></td>
<td align="center" ><strong>Shop Name</strong></td>
<td align="center" ><strong>Review</strong></td>
</tr>

 <?php
// Connects to Database
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("phase2") or die(mysql_error());

$query = mysql_query("SELECT beautyshops.shopID, shopName,reviewID, reviews.shopID, review 
FROM beautyshops,reviews WHERE reviews.shopID = beautyshops.shopID ") or die(mysql_error());

while ($row = mysql_fetch_array($query))
{
$SID = $row[beautyshops.shopID];
$SName = $row[shopName];

?>

<tr>
<td align="center" ><input name="checkbox[]" type="checkbox" id="checkbox" value="<?php echo $row['reviewID']; ?>"/></td>
<td align="center" ><strong><?php echo $SName; ?></strong></td>
<td align="center"><?php echo $row['review']; ?></td>
</tr>

 <?php
}
?>
</table>
</form>
</table>

<p align = "center"><input name="delete" type="submit" id="delete" value="Delete"/></p>

<?php
// Check if delete button active, start this
if($_POST['delete']){
//print($_POST);
$checkbox=$_POST['checkbox'];
//exit;
for($i=0;$i<count($checkbox);$i++)
{
$del_id = $checkbox[$i]; 
$result = mysql_query("DELETE FROM reviews WHERE reviewID = '$del_id'");
}

// if successful redirect to delete Reviwe.php
if($result){
echo "<meta http-equiv=\"refresh\" content=\"0;URL=test.php\">";
}
}
mysql_close();
?>

</body>
</html>

just use "POST" instead of "post". post must be in capitals... and yeah one more mistake you have done in this code is, you have set action="", it means that form will not save that value.
just use this type of code.... ummmm... let me change line 33 of your code. You can rewirite your code as this...

<form action="formproccess.php" method="POST" class = "first" >

now edit all line of your code wich contains form tag.... Definately it will work.... please mind that formproccess.php is not important to you also, it is only for me, you can change that action as you have named your php file, in which you ar trying to get that variable...

and in php file i will get that data as follows...

$first=$_POST['first']

it will store class "first" to Variable $first...

Have a nice day.... :)

commented: Um, no. +0

it doesn't work ..
I'm using action="" to load the same php page when the button is clicked.
anf this code here is to hold the checkbox value

if($_POST['delete']){
//print($_POST);
$checkbox=$_POST['checkbox'];

the code works fine when I remove the jQuery

<script language="javascript">
      $(document).ready(function(){
      $('form').jqTransform({imgPath:'jqtransformplugin/img/'});
      });
      </script>

just use "POST" instead of "post". post must be in capitals... and yeah one more mistake you have done in this code is, you have set action="", it means that form will not save that value.

what the hell are you talking about dude? do u know how code PHP? form method 'post' and 'POST' are the same... there is no issue about that.... and also there's no problem setting form action attribute to none (action=''). i dont even put action attribute on my form and i can still get the values. There no problem to a form like this example.

<?php

if(isset($_POST['btnlog-in'])){
$user =  $_POST['username'];
$pass = $_POST['password'];
}

?>

<form method='post'>
<input type='text' name='username' />
<input type='password' name='password' />
<input type='submit' name='btnlog-in' value='log-in' />
</form>

I don't know what your database struce is, but theis line looks wrong to me.

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

Just like when you loop through checkbox to get the the value, you will need to loop back though an echo again when you re-display the form.
checkbox has no cell assignment to echo the way it is now.

but this line works when i remove the style ..

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

can you please give me an example so i can understand more !!

I think this may reflect the user selection state.
The box will show checked if the condition is true or empty if false.

while ($row = mysql_fetch_array($query))
{
$SID = $row[beautyshops.shopID];
$SName = $row[shopName];
     if ($row['reviewID'])
        {
          $checked ="checked";
        }
       else
       {
       $checked ="";
       }

?>

<tr>
<td align="center" ><input name="checkbox[]" type="checkbox" id="checkbox" checked =<?PHP echo $checked; ?> value="<?php echo $row['reviewID']; ?>"/></td>
<td align="center" ><strong><?php echo $SName; ?></strong></td>
<td align="center"><?php echo $row['review']; ?></td>
</tr>

 <?php
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.