-Mike
A decent php book that has good coverage of php and oop is Web Application
Development with PHP 4.0, New Riders (this is an advanced text though) A
really good general php book is Programming PHP by Rasmus Lerdorf (from the
horses mouth!) & Kevin Tatroe, O'Reilly (in this 'Objects' get its own
chapter, which is just about as much as one can realistically expect)
An interesting article is:
http://www.devx.com/webdev/Article/10007/1954
Good luck.
D.
"Michael Scappa" <msc...@mrbcomm.com> wrote in message
news:00ba01c2ba74$ff2172b0$6400a8c0@mikeyf7jxju4px...
I submitted this problem earlier but got no response so I thought I'd
elaborate.
The code below successfully displays all of the problems from the db.
Based on what is chosen here, needs to go into another table in the db
along with a customer tracking id.
for($knt = 0;$row = mysql_fetch_row($res3); $knt++)
{
$cat_detail = $row[0];
echo "<tr><td><input type=\"checkbox\" name=\"prob[]\" value =
\"$cat_detail\"></td> <td> $cat_detail </td>"
."<td> High <input type=\"checkbox\" name=\"level[]\"
value=\"1\"></td>"
."<td> Med <input type=\"checkbox\" name=\"level[]\"
value=\"2\"></td>"
."<td> Low <input type=\"checkbox\" name=\"level[]\"
value=\"3\"></td>"
."<td><center><input type=\"checkbox\" name=\"yes\"> Yes
</center></td></tr>";
}
When this page is submitted, I can successfully capture $prob[] - but I
am having no luck in pulling the corresponding $level[] (if one was
checked). So my form - once submitted - may look like:
Problem one (no priority picked)
Problem two High priority
Problem three Low priority
My $prob[] would be: My $level[] would be:
$prob[0]: Problem one $level[0]: High
$prob[1]: Problem two $level[1]: Low
$prob[2]: Problem three
So as you can see my second problem does not correctly correspond to the
correct priority. The first (or all) element(s) in the level array may
be null.
I have read up on and tried some associative arrays but no luck in
utilizing them within a form; been trying all sorts of testing, books,
web tuts, etc. but still come up with the same problem.
Also in case anyone were to suggest sessions, my supervisor is adamently
opposed to using them on this site, not sure why, not even sure if that
would make my life easier or not since I've never used them.
Any comments (good, bad, indifferent) here would be most appreciated.
Any suggestions as to other ways of doing this also appreciated.
Many thanks
Mignon
The reason is that:
1) unchecked checkboxes do not make it into php
2) because you're not specifying an index for the array (level[]), php will
create it for you automatically
So instead of using just
name="level[]"
specify the level explicitly:
name="level[0]", name="level[1]", etc
NB you should do the same for prob[] as well.
Having done that then in your example you should get something like:
$prob[0]: Problem one
$prob[1]: Problem two $level[1]: High
$prob[2]: Problem three $level[2]: Low
NB that $level[0] is undefined.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Harp not on that string.
-- William Shakespeare, "Henry VI"
*/