Re: help needed building query string based on which form fields that are filled.
| From: | Edwin Boersma | Date: | Sun, 02 Feb 2003 10:20:43 +0000 |
| Subject: | Re: help needed building query string based on which form fields that are filled. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-133984@lists.php.net to get a copy of this message | ||
Don't get your question right, but you get all your vars in the querystring after submitting the form. There, you should check on whether or not the var is filled (i.e. $var <> "" or so). There's no other way :-( so your guess is pretty ok.
BTW: use Javascript to modify the submitted values.
Edwin
Anders Thoresson wrote:
Hi, I've got a html form where not all fields need to be filled by the users. How can I build a MySQL query based on which fields the user have filled? My guess is that I can do something like this: if(!empty($f_name)) { some_commands_to_add_$f_name_to_querystring } if(!empty($l_name)) { some_commands_to_add_$f_name_to_querystring } some_commands_to_build_querystring_based_on_if's $result = mysql_query($query) But what commands/functions should I use to build the query?