NYCPHP Meetup

NYPHP.org

need some form help...

jfreeman at amnh.org jfreeman at amnh.org
Sun May 25 09:27:02 EDT 2003


Good morning everyone.  Thanks so much for all of your help so far.  I am 
learning a lot...  but.. I'm stuck again.

As you prolly know, I'm building a LAMP app. for some scientists who are doing 
a survey of 1000 wasps nests.

I have the form completed.  For all the parts of the form that involve drop-
down lists, I have working code that goes into a table and grabs the rows in 
the table to build the drop down list in the form.

Checkboxes and radio buttons are hard coded into the form ... I'd like to be 
able to have those be built dynamically as well, using rows from various 
tables in the database but I can't figure that one out yet...

Here's a code snippet of what I use to build the drop downs:

---------------snip--------------
<?php
    $query = mysql_query("select * FROM author");


echo "select name=\\"Array[author]\\">
    <option value=\\"\\">--select author--</option>\
;
while  ($row = mysql_fetch_row($query)) {
       print  "<option value=\\$row[0]\\">$row[1]</option>\
";
     }
print ("</select>");

--------------snip----------------

so.. this works in terms of building the drop down list.  I have no idea 
whether it will work with an insert statement so that, once I've built the 
entire POST array from the form, whatever value the surveyor chooses from the 
drop down list will be inserted in the right place in the database.


I'm COMPLETELY lost with regards to how to use the name=Array[blah-blah] 
construct when it comes to checkboxes and radio buttons...

what do I do with the 'value="somevalue"' part of the checkbox or radio 
button?  where does that go with regards to the Array[blah-blah] part?

Another point of confusion... one of the fields in the survey form 
is 'survey_date'.

I have field of type 'date' in my 'specimen' table... I'd like to have 
the 'survey_date' be handled automagically for the surveyor by PHP and MySQL.. 
any suggestions on how best to accomplish that?

There's more help that I need but this is a relatively digestible chunk..

Thanks folks!

J.





More information about the talk mailing list