View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Dynamically populated form for Insert?? It can't be this hard.

Thread began 10/24/2009 1:50 am by troyd | Last modified 10/27/2009 3:43 pm by troyd | 1004 views | 4 replies

troyd

Let me simplify this even more.

If I have 1 table.
tblSubjects
ID Name Image Gender
------------------------------------
1 name1 image1.jpg male
2 name2 image2.jpg female
3 name3 image3.jpg male
4 name4 image4.jpg male
5 name5 image5.jpg female

Now I need an insert form for a second table where I match up two of the subjects, (1 male & 1 Female), making a pair.
I want two dynamic drop downs that are populated from this table. But rather than having all subject's name included in both table, I want just the males in one drop down menu and just the females in the other.

So far, I have created two record sets based on this one table. Here is what I have.

php:
mysql_select_db($database_dbCMS, $dbCMS);

$query_rsMales = "SELECT * FROM tblBreedersp WHERE sex = 'Male'";
$rsMales = mysql_query($query_rsMales, $dbCMS) or die(mysql_error());
$row_rsMales = mysql_fetch_assoc($rsMales);
$totalRows_rsMales = mysql_num_rows($rsMales);

mysql_select_db($database_dbCMS, $dbCMS);
$query_rsFemales = "SELECT * FROM tblBreedersp WHERE sex = 'Female'";
$rsFemales = mysql_query($query_rsFemales, $dbCMS) or die(mysql_error());
$row_rsFemales = mysql_fetch_assoc($rsFemales);
$totalRows_rsFemales = mysql_num_rows($rsFemales);



This works fine but I can't seem to populate the related hidden fields when their names are selected. I found a really cool Javascript that works, but there seems to be some conflicts between it and what WA wants on the page. It uses an array object. But I would like to do this with straight php if I can.

How do I create two arrays that loop through and give one menu the females and one menu the males? And include the other information as it inserts them into the new table?

Thanks,
TroyD

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...