Jump to content

Clinton

Members
  • Posts

    337
  • Joined

  • Last visited

About Clinton

  • Birthday 09/11/1982

Profile Information

  • Gender
    Male

Clinton's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Bad Form, Youngling... I guess that's still me. :-( I'll change that. Okay, so that won't cause the query to fail, and I should try it in mysql console. Here's a yongling question... where do I find that? In the phpmyadmin area????
  2. if (is_array($_POST['uid'])) { foreach($_POST['hours']AS $keyd => $value) { echo "UPDATE participantlog SET noshow=1 AND hours=" . $value . " WHERE cid=" . $cid . " AND uid=" . $keyd . "<br>"; mysql_query("UPDATE participantlog SET noshow='1' AND hours='$value' WHERE cid='$cid' AND uid='$keyd'") or die(mysql_error()); } } For some reason my query isn't executing. The foreach is working properly and producing all the right variables (as verified by the echo). But it just isn't updating the DB. Why might this be? Thanks! Clinton
  3. LoL. Yes, I was. It's always the simple things. Thanks, Jessica AND Barand!
  4. Thanks, Jessica. Getting closer. Hours: <input type="text" name="hours[<? echo $id; ?>]" size="4"> So on my form I enter 10 for one individual and 20 for another. When I run the foreach it echos the 10 and 20 correctly. But I still don't understand how to pull out the $id and associate it with hours (10 or 20). This way I can use it to update a DB. Does that make any more sense or am I just spinning my wheels missing something completely obvious? Thanks! foreach ($_POST['hours'] as $value) { echo $value . "<br>"; } CJA
  5. Rant away, TOA. I understand. Jessica, it's more of a pattern than anything else. You've always been fantastic! Barand, I understand what you're saying. This isn't about feelings and I get that arrays are basic. Yes, I have used POSTs and GETs before. :-) Here's what I know, so normally the array would be something like, name="hours[]". Then we could cycle through the arrays using something like: Now, instead of "hours[]" it is "hours[<? echo $id; ?>]" . So not only have I thrown a variable in there I've never seen/used I have no idea how to get it to do what I want. I'll keep scouring the books and interweb. CJA
  6. Barand, I greatly appreciate the help you provide here but "What's your problem (run out of coffee or cigarettes?)" <-- You said that back in 2007. I understand you're in your late 60's and probably hate the world but there's no need to be a condescending jerk. Either help or keep your smuggish comments to yourself. Perhaps consider retiring? I mean, if anybody asks you for anything above and beyond the basics you jump down their throat. Nobody wants that. PHP isn't my full time job. It's not even a part-time job. I have an understanding of the basics but have really never dabbled in array's, let's call that a weakness of mine (most people have them). I have always, though, tried to research the answer before coming to the forums and, even when an answer is provided, try to understand it further before posting additional posts. I understand the patterns, I understand that array's hold the data, I just simply don't understand how I can unpackage this data from the box. It may be simple and stupid to you so I apologize if it stoops below your ability to help me. So next time, don't. Again, you're a wealth of knowledge and I greatly appreciate what you have provided, but leave the rest of the comments out. Help or don't. Thanks.
  7. Yup. See the pattern. Just not getting how to extract the data. That's all. I'm no Guru.
  8. So, so far this is all I've been able to do: On Form Page: Hours: <input type="text" name="hours[<? echo $id; ?>]" size="4"> Process with $array = $_POST['hours']; print_r($array); Gives me: Array ( [16] => 10 [23] => 20 ) So the right ID's are there (16 and 23) along with the associated hours (10 and 20)... but how do I extract so that I can say something like ... UPDATE form SET hours=$hours WHERE id=$id The biggest thing to remember is that I never know what or how many ID's there are going to be. It all depends on what user, and how many of them, sign up for a class.
  9. No, i'm not. I'll change that. Okay, so I'm not good with arrays. Doing some research it looks like that by doing that I'm creating an associative array, right? hours1 => "7", hours2 => "9", etc. So in the processing page, how do I extract the data so it can be put into the database? Do I have to get rid of the 'hours' to extract the $id? Thanks again.
  10. Can I ask a follow-up question?? If it's a certain type of event, then this appears on the form: <? if ($type != "nmo") { ?> Hours: <input type="text" name="<? echo $id; ?>hours" size="4"> So if 4 people are generated and their ID's are 1, 2, 3, and 4, then the names become 1hours, 2hours, 3hours, and 4 hours. SO... When I hit submit and the UID is sent as an array and then the number of hours are also went, how can I break down the UID array on the processing page and append . 'hours' onto the end of it, so that I can update the database with the number of hours somebody worked? Does that make sense?
  11. Okay, I've looked at WHILE and FOREACH and can't seem to figure this out. This code works fine. It finds all the people who have signed up to participate in an event. <? $result3 = mysql_query("SELECT * FROM log WHERE cid='$cid'"); $num_rows = mysql_num_rows($result3); $seatsleft = $seats - $num_rows; ?> <font size="5"><b>Event: <? echo $ename; ?> Date: <? echo $date; ?></b></font> <form action="testle2.php" name="forward" method="post"> <table width="85%" border="1" cellspacing="0" cellpadding="0"> <tr> <td class="title"><u>NAME</u></td> <td class="title"><u>ATTENDED</u> </td> </tr> <? $sql = "SELECT FirstName, LastName, id FROM users WHERE id IN (SELECT uid from participantlog WHERE cid = '$cid') ORDER BY LastName"; $result=mysql_query($sql); while($row = mysql_fetch_array($result)) { $fname = $row['FirstName']; $lname = $row['LastName']; $id = $row['id']; ?> Now, directly underneath this code is the rest of the form. I want to select the individuals who attended and press the button and have a following page either update the database saying that they attended or did not attend. <tr> <td width="40%"><font size="5"><? echo $lname; ?>, <? echo $fname; ?> - <? echo $id; ?></font></td> <td width="60%"><input type="checkbox" name="uid" value="<? echo $id; ?>[]"><? if ($type != "nmo") { ?> Hours: <input type="text" name="hours" size="4"> <? }?></td> </tr> <? } ?> <input type="hidden" name="date" value="<? echo $date; ?>"> <input type="hidden" name="type" value="<? echo $type; ?>"> <input type="hidden" name="cid" value="<? echo $cid; ?>"> </table> <input type="submit" value="Complete & Delete"> </form> So it does everything correctly up to this point. If there are 5 individuals and I mark the checkbox that all 5 individuals attended and go to the next page, it only brings over one UID (the checkbox). I need to figure out how to correctly bring over all selected individuals and then loop it so that the DB updates for each. I've looked at both WHILE and FOREACH but none seem to do the trick. Any help appreciated. Thanks! Clinton
  12. Yes, you just sent it to me and it worked! I think I have an idea...
  13. Yeah, it's got something to do with: <p><font color='red' size='2'>You are receiving this message because you have previously signed up to do so. If you would no longer like to be an exercise participant volunteer, click <a href='http://www.blah.com/participate/yes.php?id=" . $id . "&email=" . $to . "'> here</a> to remove yourself.</font></p>"; That I have to figure out.
  14. Yup, all I got was: Hello , Below is a request for volunteer exercise participants. Follow the instructions accordingly, as they will all differ. Please direct any questions you have to the contact listed below. If you volunteer for this event, PLEASE inform the Contact listed below that you heard about this opportunity through the Participant Database!!! ------------------- MESSAGE FOLLOWS -------------------- Contact Name: Contact E-mail: Contact Telephone: I didn't get that "click here to remove" link
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.