Sorry its a lame title. Not sure really if this should be hear or over in the sql section. I know what I want to do but I'm blanking on how exactly to go about it. I'm inserting book titles into a library database and what I'd like it to do is search to make sure the author isn't all ready in the author table, if it isn't found it should pop up and ask if they want to create a bio for the author. If they click yes a text area would appear upon hitting okay the author name and bio would be inserted into the author table. If they click no at the bio prompt it should insert the author name and null for the bio.

$aSearch="select aname from authors where aname = '$author'";
	$aSearchResult=@mysql_query($aSearch) or die(@mysql_error());
	if($aSearchResult != $author){
//pseudo code
		pop up message "do you want to enter bio"
                    if(ok)
                    $bio = text from text area
                    insert into author (aname, abio) values ('$author', $'bio);
                    else
                    insert into author (aname, abio) values ('$author', 'NULL);
		
	}
Member Avatar for diafol

For a popup, you'll need JS. I've used jQueryUI in a number of projects and found it really simple. The 'multiple' forms can be held in the same dialog. Use js to change the content depending on the button click. This could be as simple as having 3 forms in the popup dialog div. Show the first and hide the rest with CSS classes (or jQuery). Then on button click show/hide the appropriate contents.

However, the dialogs may differ in size. You could always have a number of individual dialogs.

looks like I'll have to refresh myself on javascript. I've never used JQuery but I'll give it a look see.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.