PDA

View Full Version : Ajax. Couple of questions.


Violenteer
02-15-2007, 10:27 PM
Thanks for tutorials.

So much easier on Video! Though do have a question.

If I have five drop down boxes using ajax, or for that matter not using ajax. Each of these is directly underneath each other, and appears using ajax based on the previous selection.

The question is. Can the user make a search at time any time, and have a seperate search button come up each time, next to that box, and correspondingly move down the line of boxes as they appear. So effectively they choose the complexity of their search?

Another question: When I get to my third last box, the choices require that sometimes the fourth list/dropdown be bypassed and goes straight to the otpions presented in the fifth. How do I work it so that in this instance the fifth box actually appears in place of the fourth (in the fourth box position, but with fifth box options)?

Also am confused over how to get data, i.e.: name, number, web adress, email from the database into a sexy web format!

Thanks Again,

Cameron.

davidj
02-16-2007, 07:36 AM
the thing to remember here is that ajax allows for database calls without a page refresh. So this question has nothing to do with ajax.

your question relates to search complexity

what i have done before is catch the form values as normal but build up the SQL dynamicaly so lets take this example...


$id = $_POST['id'];
$id2 = $_POST['id2'];

select * from table where id = '$id' and id2 = '$id2'


and change it to this...


$id = $_POST['id'];
$id2 = $_POST['id2'];

if($id){$SQL = "id ='".$id."'";}

if($id2){$SQL .= "and id2 ='".$id2."'";}

select * from table where '$SQL'


This means your WHERE clause is created dynamicaly

davidj
02-16-2007, 07:43 AM
Also am confused over how to get data, i.e.: name, number, web adress, email from the database into a sexy web format!



where ever you echo your db $var just style the $var with CSS

example...

<span class="dbstyle"> <?php echo $row['db_column']; ?> </span>