Unstoppable Domains

Easy PHP Job for "approval" script needed ASAP

Spaceship Spaceship
Watch
Status
Not open for further replies.

rebelagent

Established Member
Impact
18
I need to meet a deadline and I can't manage to figure out how to get a multiple approve option to work.

Just doesn't work at all. I don't get errors, but it certainly doesn't update.

my mysql database looks like

thestories
-their_story
--id
--detail
--approve 'Y', 'N'
--email

I need the ability to change approve to Y when my client checks a box and submits on the approval page.

Name me your price (I don't have a large budget I did this job more for the sake of what it's going for than for what it's worth in my time, so be gentle with your quotes).

I need it asap. As it was due about 2 hours ago...I know it's about 10-15 minutes for a pro and usually I can figure this stuff out but I can figure how to count and apply the checkboxes.

here's my current code.
PHP:
<?php require('inc/dbc.php'); ?>
<?php require('inc/head.inc'); ?>
<?php require('inc/menu.inc'); 
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);

$count=mysql_num_rows($result);

?>
<p>

<table width="700" border="0" cellspacing="1" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="">
<table width="700" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF"> </td>
<td colspan="4" bgcolor="#FFFFFF"><strong>Approve multiple stories</strong> </td>
</tr>
<tr>
<td></td>
<td align="center" bgcolor="#FFFFFF"><strong>Id</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Story</strong></td>
<td align="center" bgcolor="#FFFFFF"><strong>Email</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td align="center" bgcolor="#FFFFFF"><input name="approve[]" type="checkbox" id="checkbox[]" value="approve"></td>
<td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td>
<td bgcolor="#FFFFFF"><? echo substr($rows['detail'],0,200);?>...</td>
<td bgcolor="#FFFFFF"><? echo $rows['email']; ?></td>
</tr>
<?php
}
?>
</table>
<table><tr>
<td colspan="5" align="center" bgcolor="#FFFFFF"><input name="approve" type="submit" id="submit" value="Approve"></td>
</tr></table>

<?

$fieldcount = (int) $_POST['fieldcount'];
echo "Number of checkboxes to process: $fieldcount </br>";
 
// set the array to N by default
for ( $count = 1; $count <= $approve; $count++ ) {
   $approve[$count] = "N";
}
 
// retrieve the values that are ON, i.e. TRUE
$checked = $_POST['approve'];
 
// update the array with the TRUE
if (sizeof($checked) > 0) {
   foreach($checked as $item) {
       $approve[$item] = "Y";
   }
}
 
 
// at this moment you have Y or Ns in your result array
for ( $count = 1; $count <= $fieldcount; $count++ ) {
   echo "approve[" .$count . "] = $approve[$count] </br>";
}


mysql_close();
?>
</table>
</form>
</td>
</tr>
</table>

<?php require('inc/foot.inc'); ?>


Please make up a fake database and show me that it works via your website. After seeing it works I will send you payment via paypal.

If I skipped out on a detail please let me know. I'm so tired and it's almost 5am here. My real day job starts in 3 hours, so that means I get 2 hours of sleep! Yay..... :|
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Status
Not open for further replies.

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back