Reply to Re: Getting two variables from a PHP loop

Your name:

Reply:


Posted by chimambo on 05/18/07 14:46

On 18 May, 15:10, "rickycorn...@gmail.com" <rickycorn...@gmail.com>
wrote:
> On May 18, 7:02 am, chima...@googlemail.com wrote:
>
> > Hi Everyone,
> > I have a huge problem. I am trying to get two corresponding variables
> > from a Checkbox and a Text box. e.g. If I check a value, say:
> > enrolled? [] (checkbox) then I have to put the date enrolled as a
> > text.
>
> I'm kind of confused- you mean the form is submitted, and if the
> enrolled checkbox was checked, populate the enrollment date text
> field? I'll go on that assumption.
>
>
>
>
>
> > So when inserting in a table I want the enrolled to correspond
> > to each date. Here is what I am trying but not working (In the echos
> > is where I am trying to have the values into the table):
>
> > while (list($key, $val) = @each ($box))
> > {
> > echo "$val";
> > while (list($key, $v_val) = @each ($dose))
> > {
> > echo "$v_val";
> > }}
>
> > echo "<form method=post action=''>";
> > echo "<table border='0' cellspacing='0' style='border-collapse:
> > collapse' width='100' >
>
> > <tr bgcolor='white'>
> > <td width='25%'><input type=checkbox name=box[] value='John'></td>
> > <td width='13%'>&nbsp;John</td>
> > <td width='12%'><input type=text name=date[] size=8></td>
> > <td width='25%'><input type=checkbox name=box[] value='Peter'></td>
> > <td width='13%'>&nbsp;Peter</td>
> > <td width='12%'><input type=text name=date[] size=8></td>
> > ......
> > .....
>
> [?php
> if($enrolled == "on") {
> $enrollment_date = $dbh->query("SELECT enroll_date FROM students
> WHERE id = 'studentid'");}
>
> ?]
> [input type='text' name='enrollment_date' value='[?=
> $enrollment_date; ?]']
>
> Like that? Am I missing something?- Hide quoted text -
>
> - Show quoted text -

Thanks for the reply but what I want is like this (hypothetically):

Student name [Peter] Enrolled? [] Date Enrolled [ ]
Student name [John ] Enrolled? [] Date Enrolled [ ]

Then applying the loop to insert the two records. Hope this makes
sense..

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация