Page 1 of 1

Form Malfunctioning

Posted: Sun Apr 03, 2011 11:10 pm
by robynprivette
The error I am getting is there use to be a box to uncheck/check all but it's gone. Also when a person checks one option and hits submit, it checks them all and submits all. Here is my code.

Code: Select all

<script type='text/javascript'>
checked=false;
function checkAll () {
var aa= document.getElementById('lomp');
if (checked == false)
{
checked = true
}
else
{
checked = false
}
for (var i =0; i < aa.elements.length; i++)
{
aa.elements[i].checked = checked;
}
}
</script>

<style>
body {
 background: transparent;
 color:#000;
font: normal small Verdana, Helvetica, sans-serif;
font-size: 8px;
 }

 table {
 margin:auto;
 background: transparent;
 color:#000;
 width:100%;
 height:100;
 border:1px solid #B0C3D1;
 font: normal small Verdana, Helvetica, sans-serif;
 font-size: 8px;
 cellpadding:0px;
 cellspacing:0px;
 text-align: center;
}

.input {
    border: 1px solid #006;
    background: #ffc;
}
.input:hover {
    border: 1px solid #B0C3D1;
    background: #ff6;
}
.button {
    font-size: 10px;
    border: 1px solid #B0C3D1;
    background: #ccf;
}
.button:hover {
    font-size: 10px;
    border: 1px solid #B0C3D1;
    background: #eef;
}
label {
    display: block;
    width: 150px;
    float: left;
    margin: 2px 4px 6px 4px;
    text-align: right;
}
br { clear: left; 
}
</style>

</head>



<body>

<table border=1px>
<tr>
<th>Image</th>
<th>add dragon</th></tr>
<form name="form1" id="lomp" method="get" action="ScrollReadGet.php"> 
<?php
ini_set("display_errors",false);
$fdd = $_POST['user'];
$user = str_replace(" ","%20","$fdd");
echo ''.$fdd.'';
echo '<input type=hidden value="'.$user.'" name=user><br>';
$young = unserialize(file_get_contents('http://dragcave.net/api/thehatch2010/serialize/user_young/'.$user.''));

foreach($young['errors'] as $error) {
  if($error[0] == 3) {echo '<center>Sorry, we were unable to locate that scroll.</center>'; return;}
}

foreach($young['errors'] as $error) {
  if($error[0] == 4) {echo '<center>Sorry, this user has no dragons.</center>'; return;}
}


foreach ($young['dragons'] as $key => $value) {
$data = unserialize(file_get_contents('http://dragcave.net/api/thehatch2010/serialize/view/'.$key));
  echo '
<tr><td><a href="http://www.dragcave.net/view/'.$key.'"><img src="http://www.dragcave.net/image/'.$key.gif.'" border="0"></a></td>';
  echo '<td><input type="checkbox" name="checkboxes[]" value="'.$key.'" border="0"></a></td></tr>';
}
foreach ($data['clicks'] as $help => $me) {
  echo '$help';
}


?>
<td colspan="2"<input type='checkbox' name='checkz' onClick='checkAll();'>Check all/Uncheck all<br>
<input type="submit" name="Submit" class="button" value="Add Dragons"></td>
</tr>
</table>

Re: Form Malfunctioning

Posted: Sun Apr 03, 2011 11:39 pm
by robynprivette
I figured out the problem! *smacks forehead* I was missing a ">" at the very end!!!

New question. How can I make it so that it remembers what options the user has checked? (like when they come back to add something, what they've already added is already checked)