RE: [PHP] Looking for help with forms/variables and an array!
I got a little bit further, but still feel like the "monkey with a light-bulb"! Over $2 million -Original Message----- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 4:21 AM To: php-general@lists.php.net Subject: [PHP] Looking for help with forms/variables and an array! Dreamweaver help me with a good part of this, but now I am in the nitty gritty code and trying to figure out. General concept: A selection box has 4 options, php queries the Mysql database for matching options. Then a second options box with another 4 options filters the query even more. Aspects I am a little stuck on. 1 associating options (in drop down box) with a variable 2 carrying the result set over two the second drop down box Producing my final result set. Here are some snippets of where I am at. First selection box: market option1 option2 option3 option4 Second selection box: market option1 option2 option3 option4 $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE range = '1'"; The number one is what the first set of just above is what form one is supposed to change. After that, how is the world am I going to do it twice for the second part of the query? Some good literature on how to do it TWICE would really help understand this. I find tons of stuff on doing it once! Thank you kindly for any guidance you can provide. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
I am game for anything that works and works fast and easy. I am just wondering if I am opening up a whole new can of worms? Cheers! Brad -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 6:06 AM To: BSumrall Subject: RE: [PHP] Looking for help with forms/variables and an array! Hi, I use Javascript. I also use Firefox. I use Apache as my server on WinNT, but Ajax also works on Linux servers (mainly because its a client-side application). Let me know if you need help setting up Ajax and/or testing. Cheers George > -Original Message- > From: BSumrall [mailto:[EMAIL PROTECTED] > Sent: 12 June 2007 10:54 am > To: 'George Pitcher' > Subject: RE: [PHP] Looking for help with forms/variables and an array! > > > Interesting suggestion. > > I though ajax was mainly gear towards microsoft and javascripting > applications? > > > -Original Message- > From: George Pitcher [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 12, 2007 5:42 AM > To: BSumrall > Subject: RE: [PHP] Looking for help with forms/variables and an array! > > Hi, > > Have you looked at Ajax? This will do just what you have > described. When the > user makes their first choice, Ajax queries the database to return the > options for the secont drop-down box. > > George > > > -Original Message- > > From: BSumrall [mailto:[EMAIL PROTECTED] > > Sent: 12 June 2007 9:34 am > > To: php-general@lists.php.net > > Subject: RE: [PHP] Looking for help with forms/variables and an array! > > > > > > I got a little bit further, but still feel like the "monkey with a > > light-bulb"! > > > > Over $2 million > > > > > > > > -Original Message- > > From: BSumrall [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, June 12, 2007 4:21 AM > > To: php-general@lists.php.net > > Subject: [PHP] Looking for help with forms/variables and an array! > > > > > > Dreamweaver help me with a good part of this, but now I am in the nitty > > gritty code and trying to figure out. > > > > General concept: > > > > A selection box has 4 options, php queries the Mysql database > for matching > > options. > > > > Then a second options box with another 4 options filters the query even > > more. > > > > Aspects I am a little stuck on. > > > > 1 associating options (in drop down box) with a variable > > 2 carrying the result set over two the second drop down box > > > > Producing my final result set. > > > > Here are some snippets of where I am at. > > > > First selection box: > > > > > > market > > > >option1 > >option2 > >option3 > >option4 > > > > > > > > > > Second selection box: > > > > > > market > > > >option1 > >option2 > >option3 > >option4 > > > > > > > > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE range = '1'"; > > > > The number one is what the first set of just above is what form one is > > supposed to change. > > > > After that, how is the world am I going to do it twice for the > second part > > of the query? > > > > Some good literature on how to do it TWICE would really help understand > > this. > > > > I find tons of stuff on doing it once! > > > > Thank you kindly for any guidance you can provide. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
Is it a GUI based application? Brad -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 6:06 AM To: BSumrall Subject: RE: [PHP] Looking for help with forms/variables and an array! Hi, I use Javascript. I also use Firefox. I use Apache as my server on WinNT, but Ajax also works on Linux servers (mainly because its a client-side application). Let me know if you need help setting up Ajax and/or testing. Cheers George > -Original Message- > From: BSumrall [mailto:[EMAIL PROTECTED] > Sent: 12 June 2007 10:54 am > To: 'George Pitcher' > Subject: RE: [PHP] Looking for help with forms/variables and an array! > > > Interesting suggestion. > > I though ajax was mainly gear towards microsoft and javascripting > applications? > > > -Original Message- > From: George Pitcher [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 12, 2007 5:42 AM > To: BSumrall > Subject: RE: [PHP] Looking for help with forms/variables and an array! > > Hi, > > Have you looked at Ajax? This will do just what you have > described. When the > user makes their first choice, Ajax queries the database to return the > options for the secont drop-down box. > > George > > > -Original Message- > > From: BSumrall [mailto:[EMAIL PROTECTED] > > Sent: 12 June 2007 9:34 am > > To: php-general@lists.php.net > > Subject: RE: [PHP] Looking for help with forms/variables and an array! > > > > > > I got a little bit further, but still feel like the "monkey with a > > light-bulb"! > > > > Over $2 million > > > > > > > > -Original Message- > > From: BSumrall [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, June 12, 2007 4:21 AM > > To: php-general@lists.php.net > > Subject: [PHP] Looking for help with forms/variables and an array! > > > > > > Dreamweaver help me with a good part of this, but now I am in the nitty > > gritty code and trying to figure out. > > > > General concept: > > > > A selection box has 4 options, php queries the Mysql database > for matching > > options. > > > > Then a second options box with another 4 options filters the query even > > more. > > > > Aspects I am a little stuck on. > > > > 1 associating options (in drop down box) with a variable > > 2 carrying the result set over two the second drop down box > > > > Producing my final result set. > > > > Here are some snippets of where I am at. > > > > First selection box: > > > > > > market > > > >option1 > >option2 > >option3 > >option4 > > > > > > > > > > Second selection box: > > > > > > market > > > >option1 > >option2 > >option3 > >option4 > > > > > > > > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE range = '1'"; > > > > The number one is what the first set of just above is what form one is > > supposed to change. > > > > After that, how is the world am I going to do it twice for the > second part > > of the query? > > > > Some good literature on how to do it TWICE would really help understand > > this. > > > > I find tons of stuff on doing it once! > > > > Thank you kindly for any guidance you can provide. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
-Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 5:54 AM To: 'George Pitcher' Subject: RE: [PHP] Looking for help with forms/variables and an array! Interesting suggestion. I though ajax was mainly gear towards microsoft and javascripting applications? -Original Message- From: George Pitcher [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 5:42 AM To: BSumrall Subject: RE: [PHP] Looking for help with forms/variables and an array! Hi, Have you looked at Ajax? This will do just what you have described. When the user makes their first choice, Ajax queries the database to return the options for the secont drop-down box. George > -Original Message- > From: BSumrall [mailto:[EMAIL PROTECTED] > Sent: 12 June 2007 9:34 am > To: php-general@lists.php.net > Subject: RE: [PHP] Looking for help with forms/variables and an array! > > > I got a little bit further, but still feel like the "monkey with a > light-bulb"! > > Over $2 million > > > > -Original Message- > From: BSumrall [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 12, 2007 4:21 AM > To: php-general@lists.php.net > Subject: [PHP] Looking for help with forms/variables and an array! > > > Dreamweaver help me with a good part of this, but now I am in the nitty > gritty code and trying to figure out. > > General concept: > > A selection box has 4 options, php queries the Mysql database for matching > options. > > Then a second options box with another 4 options filters the query even > more. > > Aspects I am a little stuck on. > > 1 associating options (in drop down box) with a variable > 2 carrying the result set over two the second drop down box > > Producing my final result set. > > Here are some snippets of where I am at. > > First selection box: > > > market > > option1 > option2 > option3 > option4 > > > > > Second selection box: > > > market > > option1 > option2 > option3 > option4 > > > > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE range = '1'"; > > The number one is what the first set of just above is what form one is > supposed to change. > > After that, how is the world am I going to do it twice for the second part > of the query? > > Some good literature on how to do it TWICE would really help understand > this. > > I find tons of stuff on doing it once! > > Thank you kindly for any guidance you can provide. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
I am sure I am on the right track. Register globals is turned on! I am getting the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[''] LIMIT 0, 1' at line 1 mysql_select_db($database_ftn, $ftn); @extract($_POST); $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range= '[$select1]'"; I am trying to get a php form variable into the above sql query. '[$select1]' if changed back to the number 1 will bring up a record just fine. Putting in a variable produces the error. How do I get a php form variable into a sql query? Below is my form market Indiana Wisconsin Illinois Michigan Georgia Florida Brad > > Interesting suggestion. > > I though ajax was mainly gear towards microsoft and javascripting > applications? > > > -Original Message- > From: George Pitcher [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 12, 2007 5:42 AM > To: BSumrall > Subject: RE: [PHP] Looking for help with forms/variables and an array! > > Hi, > > Have you looked at Ajax? This will do just what you have > described. When the > user makes their first choice, Ajax queries the database to return the > options for the secont drop-down box. > > George > > > -Original Message- > > From: BSumrall [mailto:[EMAIL PROTECTED] > > Sent: 12 June 2007 9:34 am > > To: php-general@lists.php.net > > Subject: RE: [PHP] Looking for help with forms/variables and an array! > > > > > > I got a little bit further, but still feel like the "monkey with a > > light-bulb"! > > > > Over $2 million > > > > > > > > -Original Message- > > From: BSumrall [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, June 12, 2007 4:21 AM > > To: php-general@lists.php.net > > Subject: [PHP] Looking for help with forms/variables and an array! > > > > > > Dreamweaver help me with a good part of this, but now I am in the nitty > > gritty code and trying to figure out. > > > > General concept: > > > > A selection box has 4 options, php queries the Mysql database > for matching > > options. > > > > Then a second options box with another 4 options filters the query even > > more. > > > > Aspects I am a little stuck on. > > > > 1 associating options (in drop down box) with a variable > > 2 carrying the result set over two the second drop down box > > > > Producing my final result set. > > > > Here are some snippets of where I am at. > > > > First selection box: > > > > > > market > > > >option1 > >option2 > >option3 > >option4 > > > > > > > > > > Second selection box: > > > > > > market > > > >option1 > >option2 > >option3 > >option4 > > > > > > > > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE range = '1'"; > > > > The number one is what the first set of just above is what form one is > > supposed to change. > > > > After that, how is the world am I going to do it twice for the > second part > > of the query? > > > > Some good literature on how to do it TWICE would really help understand > > this. > > > > I find tons of stuff on doing it once! > > > > Thank you kindly for any guidance you can provide. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
The purpose for register_globals is for testing and functionality purposes only. Every single example on the internet is for register_globals = on. I am very aware of the security risk of it. Get it working and then change it back. There is plenty of literature on how to edit existing working code once you disable it. Just working with the tools I have! As far as _tbl instead of table, I picked that one up in the military, just a preference. As far as the brackets, I tried with or without; price_range='[$select1]'"; price_range='$select1'"; price_range=select1"; All the same miserable error! Any suggestions on how to get select1 -> price_range= would truly be appreciated, and if your suggestion it more secure than what I am working with. This would be the icing on the cake! Brad -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 12:38 PM To: BSumrall Cc: php-general@lists.php.net Subject: RE: [PHP] Looking for help with forms/variables and an array! On Tue, 2007-06-12 at 12:19 -0400, BSumrall wrote: > I am sure I am on the right track. > Register globals is turned on! > > I am getting the following error: > > You have an error in your SQL syntax; check the manual that corresponds to > your MySQL server version for the right syntax to use near '[''] LIMIT 0, 1' > at line 1 > > mysql_select_db($database_ftn, $ftn); > @extract($_POST); BAD!!! BAD DOG!!! This is probably worse than register globals since it allows clobbering of variables AFTER you've defined any other local scope vars. Besides, it's redundant if you have register_globals on as you say above. But having register_globals is BAD! BAD DOG!! GO TO YOUR KENNEL! > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range= > '[$select1]'"; What's with the square brackets? Why haven't your escaped the $select value before using it in a query? Are you using the magic quotes GPC? If so... BAD!!! BAD DOG!! What the hell is lstng_tbl?? Or are you allergic to the readability enahcning properties of vowels? If so... BAD DOG!! BAAAD DG! Go play with traffic! Why do you post fix it with _tpl? Of course it's a friggin' table. > I am trying to get a php form variable into the above sql query. > '[$select1]' if changed back to the number 1 will bring up a record just > fine. > Putting in a variable produces the error. Who's putting in the variables? you or your visitors? *lol* > How do I get a php form variable into a sql query? > > Below is my form > > > > > market > > Indiana > Wisconsin > Illinois > Michigan > Georgia > Florida > > > $query = "SELECT " ."* " ."FROM " ."listing " ."WHERE " ."price_range = '".mysql_real_escape_string( $_POST['select1'] )."' "; Cheers, Rob. Ps. BAD DOG!! :) -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
It doesn't like the curly brackets either! Brad -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 12:39 PM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] Looking for help with forms/variables and an array! BSumrall wrote: > I am sure I am on the right track. > Register globals is turned on! > > I am getting the following error: > > You have an error in your SQL syntax; check the manual that corresponds to > your MySQL server version for the right syntax to use near '[''] LIMIT 0, 1' > at line 1 > > mysql_select_db($database_ftn, $ftn); > @extract($_POST); > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range= > '[$select1]'"; $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = '[$select1]'"; Why do you have brackets in this statement? Are they actually in the data that way? Try this, curly braces: $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = '{$select1}'"; > > I am trying to get a php form variable into the above sql query. > '[$select1]' if changed back to the number 1 will bring up a record just > fine. > Putting in a variable produces the error. > > How do I get a php form variable into a sql query? > > Below is my form > > > > > market > > Indiana > Wisconsin > Illinois > Michigan > Georgia > Florida > > > > > > Brad > > > > > >> Interesting suggestion. >> >> I though ajax was mainly gear towards microsoft and javascripting >> applications? >> >> >> -Original Message- >> From: George Pitcher [mailto:[EMAIL PROTECTED] >> Sent: Tuesday, June 12, 2007 5:42 AM >> To: BSumrall >> Subject: RE: [PHP] Looking for help with forms/variables and an array! >> >> Hi, >> >> Have you looked at Ajax? This will do just what you have >> described. When the >> user makes their first choice, Ajax queries the database to return the >> options for the secont drop-down box. >> >> George >> >>> -Original Message- >>> From: BSumrall [mailto:[EMAIL PROTECTED] >>> Sent: 12 June 2007 9:34 am >>> To: php-general@lists.php.net >>> Subject: RE: [PHP] Looking for help with forms/variables and an array! >>> >>> >>> I got a little bit further, but still feel like the "monkey with a >>> light-bulb"! >>> >>> Over $2 million >>> >>> >>> >>> -Original Message- >>> From: BSumrall [mailto:[EMAIL PROTECTED] >>> Sent: Tuesday, June 12, 2007 4:21 AM >>> To: php-general@lists.php.net >>> Subject: [PHP] Looking for help with forms/variables and an array! >>> >>> >>> Dreamweaver help me with a good part of this, but now I am in the nitty >>> gritty code and trying to figure out. >>> >>> General concept: >>> >>> A selection box has 4 options, php queries the Mysql database >> for matching >>> options. >>> >>> Then a second options box with another 4 options filters the query even >>> more. >>> >>> Aspects I am a little stuck on. >>> >>> 1 associating options (in drop down box) with a variable >>> 2 carrying the result set over two the second drop down box >>> >>> Producing my final result set. >>> >>> Here are some snippets of where I am at. >>> >>> First selection box: >>> >>> >>> market >>> >>>option1 >>>option2 >>>option3 >>>option4 >>> >>> >>> >>> >>> Second selection box: >>> >>> >>> market >>> >>>option1 >>>option2 >>>option3 >>>option4 >&g
RE: [PHP] Looking for help with forms/variables and an array!
Wow, Thank you! You appear to have gotten me 90% towards my mission final. mysql_select_db($database_ftn, $ftn); @extract($_POST); $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = '$select1'"; echo $query_Recordset1; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1, $ftn) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); market Indiana Wisconsin Illinois Michigan Georgia Florida Works! Thank you! Thank you! Thank you! Sincerely, Brad -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 1:57 PM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] Looking for help with forms/variables and an array! BSumrall wrote: > It doesn't like the curly brackets either! > > Brad > if this is within PHP, the '{' and '}' are within double quotes (which they seem to be), These examples should all do the same thing. $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = '$select1'"; $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = '{$select1}'"; $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = '".$select1."'"; echo $query_Recordset1; place an echo just after including the variable and see if you see the brackets in the statement. -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
I, I, sir! I changed it back! :o) Point noted! -Original Message- From: Robert Cummings [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 1:24 PM To: BSumrall Cc: php-general@lists.php.net Subject: RE: [PHP] Looking for help with forms/variables and an array! On Tue, 2007-06-12 at 13:02 -0400, BSumrall wrote: > The purpose for register_globals is for testing and functionality purposes > only. > Every single example on the internet is for register_globals = on. That's no excuse... and you're wrong. > I am very aware of the security risk of it. Ok... and magic_quotes? You don't seem to be escaping your data that goes into the query either. You don't seem very "aware of the security risk". > Get it working and then change it back. There is plenty of literature on how > to edit existing working code once you disable it. Why do it twice? Why risk forgetting something after the fact? Coding securely requires that you practice coding securely and not just hope you can apply a coat of armorall afterwards. > Just working with the tools I have! The same tools I have, if not then you have more. > As far as _tbl instead of table, I picked that one up in the military, just > a preference. > > As far as the brackets, I tried with or without; > price_range='[$select1]'"; > price_range='$select1'"; > price_range=select1"; > > All the same miserable error! > > Any suggestions on how to get select1 -> price_range= would truly > be appreciated, and if your suggestion it more secure than what I am working > with. This would be the icing on the cake! I gave you an example at the bottom of my post. Are you passing the $query string directly to the mysql_query() function? Maybe do the following just before running the query: echo $query."\n"; Then check it to see that it's what you expect. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
I thank you kindly for your pointers. It did really help me with getting further. Persons like yourself are truly talented to be able and bang out the theory like that on the fly. Only problem is that I am using php to learn code for the first real time. The Microsoft stuff started to throw me off. I am going sit hear and study your example intently and hopefully it will clue me off on my major variable error. I am right there with it! Brad -Original Message- From: Dan Shirah [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 3:05 PM To: Jim Lucas Cc: BSumrall; php-general@lists.php.net Subject: Re: [PHP] Looking for help with forms/variables and an array! Wouldn't a little javascript solve this problem?? Have your first dropdown menu, then when an option is selected use a javascript Onchange function to refresh (post) the page to itself. This would set the selected option as your "form1" value. Then just write a simple query using that value to return the options you want for dropdown #2. Something like this: Alabama Florida Washington Michigan if (!isset($_POST['submit'])) { $state = $_POST['states']; Then put your result in an array and populate your second dropdown. City: --SELECT--\n"; foreach ($c_city as $s_city) { if ($s_city['state_name'] == $_POST['states']) echo "{$s_city['city_name']}\n"; else echo "{$s_cc['city_name']}\n"; } ?> Hope that helps?? lol On 6/12/07, Jim Lucas <[EMAIL PROTECTED]> wrote: > > BSumrall wrote: > > It doesn't like the curly brackets either! > > > > Brad > > > > if this is within PHP, the '{' and '}' are within double quotes (which > they seem to be), > > These examples should all do the same thing. > > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = > '$select1'"; > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = > '{$select1}'"; > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = > '".$select1."'"; > > echo $query_Recordset1; > > place an echo just after including the variable and see if you see the > brackets in the statement. > > > -- > Jim Lucas > >"Some men are born to greatness, some achieve greatness, >and some have greatness thrust upon them." > > Twelfth Night, Act II, Scene V > by William Shakespeare > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
Is there much support for it? I didn't seem to find much support on ajax. And I think this is the win all, kill all. PhP seems now and has been granddaddy of Linux file handlers just next to Perl or Python. For those whom do not touch Microsoft for anything other than play movies but survive on business systems. How well does it flip switches, move files, and changes permissions on Fedora, CentOS, and OpenBSD? Brad -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 4:03 PM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] Looking for help with forms/variables and an array! On Tue, June 12, 2007 3:20 am, BSumrall wrote: > Dreamweaver help me with a good part of this, No comment... > A selection box has 4 options, php queries the Mysql database for > matching > options. > > Then a second options box with another 4 options filters the query > even > more. When the user picks from the first 4, do the second 4 change? If so, you have to do that in JavaScript, because PHP is long gone from the picture by the time the use chooses. > 1 associating options (in drop down box) with a variable The name="select" part forms an association between the user choice and: $_POST['select'] > 2 carrying the result set over two the second drop down box If you want to do this while the user is clicking, it's JavaScript, not PHP. > Producing my final result set. > > Here are some snippets of where I am at. > > First selection box: > > > market > > option1 > option2 > option3 > option4 > > > > > Second selection box: > > > market > Use a different name for this one. Call it "select2" perhaps. Or name the first one "select[1]" and this one is "select[2]" $_POST['select'] will then be an array with indexes 1 and 2. > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE range = '1'"; > > The number one is what the first set of just above is what form one is > supposed to change. > > After that, how is the world am I going to do it twice for the second > part > of the query? if (isset($_POST['select']) && isset($_POST['select'][1]) && isset($_POST['select'][2])){ $range1 = (int) S_POST['select'][1]; $range2 = (int) $_POST['select'][2]; $query = "SELECT * FROM lstng_tbl WHERE range1 = $range1 and range2 = $range2"; } Or, perhaps you want: $query = "SELECT * FROM lstng_tbl WHERE range BETWEEN $range1 and $range2"; Or... I dunno what you might want. Could be almost anything. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
I had done that before, But here it goes again because I have learned a little bit more -> establish db connect -> drop down box stores result as a variable -> first initial query performed -> query array established -> drop down box 2 is saved as a variable -> variable 2 filters query 1 -> display one record at a time Here is what I have right now. It is error free, just doest work, all I have done change some variables and not even bothering with record set 2 yet Anything in bold is what I have played with since it would pull every record, just not filter and now does not work. Brad market Indiana Wisconsin Illinois Michigan Georgia Florida price_range Over $2 million $1 million - $2 million $750,000 - $1 million under $750,000 -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 8:26 PM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] Looking for help with forms/variables and an array! Are you wanting to setup some sorta pagination, or just get the results from the DB limited by the selected option in the form? oh, where is your second form in this example? In pseudo code, write out what you are attempting to do? -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare
RE: [PHP] Looking for help with forms/variables and an array!
_ From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 8:46 PM To: 'Jim Lucas' Cc: 'php-general@lists.php.net' Subject: RE: [PHP] Looking for help with forms/variables and an array! I had done that before, But here it goes again because I have learned a little bit more -> establish db connect -> drop down box stores result as a variable -> first initial query performed -> query array established -> drop down box 2 is saved as a variable -> variable 2 filters query 1 -> display one record at a time Here is what I have right now. It is error free, just doest work, all I have done change some variables and not even bothering with record set 2 yet Anything in bold is what I have played with since it would pull every record, just not filter and now does not work. Brad market Indiana Wisconsin Illinois Michigan Georgia Florida price_range Over $2 million $1 million - $2 million $750,000 - $1 million under $750,000 -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 8:26 PM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] Looking for help with forms/variables and an array! Are you wanting to setup some sorta pagination, or just get the results from the DB limited by the selected option in the form? oh, where is your second form in this example? In pseudo code, write out what you are attempting to do? -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare
RE: [PHP] Looking for help with forms/variables and an array!
-Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 7:52 PM To: '[EMAIL PROTECTED]' Subject: RE: [PHP] Looking for help with forms/variables and an array! Don't be a hater! :o) I know I am a newbie for flat out application programming. I am used to just tweaking! Lately I have been asked to pull the stuff out of the air, so looking to the mailing list to help guide me. I have read all the books, but that does not mean anything till you are in the weeds! Basically all I am trying to accomplish is 2 separate SQL query filter -> first (from a db of 1000 records) get the houses from $state -> second, from that query, get the ones of $value_range -> third, display them and there info one at a time I am getting my but handed to me on $state right now I can pull them all up at once or just one! Brad -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 4:13 PM To: BSumrall Cc: 'Robert Cummings'; php-general@lists.php.net Subject: RE: [PHP] Looking for help with forms/variables and an array! On Tue, June 12, 2007 12:02 pm, BSumrall wrote: > Every single example on the internet is for register_globals = on. Actually, this is not at all true. And, really, fixing the example before you run it to not need register_globals is the way to go. > As far as the brackets, I tried with or without; > price_range='[$select1]'"; > price_range='$select1'"; > price_range=select1"; > > All the same miserable error! Not EXACTLY the same miserable error. You're still writing invalid SQL, but it's invalid in different ways each time. echo out your query, and see how it looks, and compare it to how the query should look. echo $query_Recordset1; PS extract($_POST) is just as bad as register_globals, so don't do that. Maybe you want something more like: $price_minimum = (int) $_POST['select1']; $price_maximum = (int) $_POST['select2']; $price_minimum_sql = mysql_real_escape_string($price_minimum); $price_maximum_sql = mysql_real_escape_string($price_maximum); $query = "select * from whatever where price >= $price_minimum_sql and price <= $price_maximum_sql"; Though it looks like you've set up price "brackets" so maybe it won't be quite like that... Still it's closer than what you have now. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
-Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 7:30 PM To: 'Dan Shirah' Cc: 'php-general@lists.php.net' Subject: RE: [PHP] Looking for help with forms/variables and an array! I thank you kindly for your pointers. It did really help me with getting further. Persons like yourself are truly talented to be able and bang out the theory like that on the fly. Only problem is that I am using php to learn code for the first real time. The Microsoft stuff started to throw me off. I am going sit hear and study your example intently and hopefully it will clue me off on my major variable error. I am right there with it! Brad -Original Message- From: Dan Shirah [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 3:05 PM To: Jim Lucas Cc: BSumrall; php-general@lists.php.net Subject: Re: [PHP] Looking for help with forms/variables and an array! Wouldn't a little javascript solve this problem?? Have your first dropdown menu, then when an option is selected use a javascript Onchange function to refresh (post) the page to itself. This would set the selected option as your "form1" value. Then just write a simple query using that value to return the options you want for dropdown #2. Something like this: Alabama Florida Washington Michigan if (!isset($_POST['submit'])) { $state = $_POST['states']; Then put your result in an array and populate your second dropdown. City: --SELECT--\n"; foreach ($c_city as $s_city) { if ($s_city['state_name'] == $_POST['states']) echo "{$s_city['city_name']}\n"; else echo "{$s_cc['city_name']}\n"; } ?> Hope that helps?? lol On 6/12/07, Jim Lucas <[EMAIL PROTECTED]> wrote: > > BSumrall wrote: > > It doesn't like the curly brackets either! > > > > Brad > > > > if this is within PHP, the '{' and '}' are within double quotes (which > they seem to be), > > These examples should all do the same thing. > > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = > '$select1'"; > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = > '{$select1}'"; > $query_Recordset1 = "SELECT * FROM lstng_tbl WHERE price_range = > '".$select1."'"; > > echo $query_Recordset1; > > place an echo just after including the variable and see if you see the > brackets in the statement. > > > -- > Jim Lucas > >"Some men are born to greatness, some achieve greatness, >and some have greatness thrust upon them." > > Twelfth Night, Act II, Scene V > by William Shakespeare > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Looking for help with forms/variables and an array!
This is everything with the last lines being. And those are the final recordset commands set in by Dreamweaver. http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> Untitled Document market Indiana Wisconsin Illinois Michigan Georgia Florida price_range Over $2 million $1 million - $2 million $750,000 - $1 million under $750,000 0) { // Show if not first page ?> ">First 0) { // Show if not first page ?> ">Previous ">Next ">Last -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 12, 2007 11:51 PM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] Looking for help with forms/variables and an array! Take a look again. This can't be ALL your code Your last line is Where is the rest of your file??? Jim Lucas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I have a problem with nobody!
I have been googling this to death and have many references to this, but all solutions seem to either 1 not apply 2 result in parse error The code: mail ($to, $subject, $message, $header); The error Email is sent to recipient as [EMAIL PROTECTED] (fqdn = fully qualified domain name) I have read about a -f function. I tried mail ($to, $subject, $message, -f$header); mail -f($to, $subject, $message, $header); both result in parse error. I read about changing a php_value in my httpd.conf Couldn't find any reference. So, I turn to my friends on the php_list Any assistance would really be appreciated! Running CentOS Cpanel Exim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I have a problem with nobody!
PS mail ($to, $subject, $message, $header, '-f [EMAIL PROTECTED]'); doesn't work either. Still have nobody to deal with. As per being RFC compliant! -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:15 AM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] I have a problem with nobody! BSumrall wrote: > I have read about a -f function. > I tried > mail ($to, $subject, $message, -f$header); > mail -f($to, $subject, $message, $header); > > both result in parse error. Boy did you not read the documentation carefully! mail($to, $subject, $message, $headers, '[EMAIL PROTECTED]'); Go back and read http://php.net/function.mail properly. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I have a problem with nobody!
Well, I am now 1 step closer The php file do nor reference the importance of "having no spaces" between the -f and email address. [EMAIL PROTECTED] is key! But, still can't get rid of nobody. How do I make nobody disappear? Here is my message header now. Nobody [EMAIL PROTECTED] Using: mail ($to, $subject, $message, $header, '[EMAIL PROTECTED]'); -Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:19 AM To: 'Stut' Cc: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! PS mail ($to, $subject, $message, $header, '-f [EMAIL PROTECTED]'); doesn't work either. Still have nobody to deal with. As per being RFC compliant! -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:15 AM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] I have a problem with nobody! BSumrall wrote: > I have read about a -f function. > I tried > mail ($to, $subject, $message, -f$header); > mail -f($to, $subject, $message, $header); > > both result in parse error. Boy did you not read the documentation carefully! mail($to, $subject, $message, $headers, '[EMAIL PROTECTED]'); Go back and read http://php.net/function.mail properly. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I have a problem with nobody!
Let's take it one step further for arguments sake. What is I wanted to change "nobody" as the sender to, let's just say Larry or Curly, or Moe? Making message header as; Larry Shmuckatelli [EMAIL PROTECTED] Or Curly Shmuckatelli [EMAIL PROTECTED] Or Moe Shmuckatelli [EMAIL PROTECTED] What is the php driving force that controls the "who sent me" function? -----Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:31 AM To: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! Well, I am now 1 step closer The php file do nor reference the importance of "having no spaces" between the -f and email address. [EMAIL PROTECTED] is key! But, still can't get rid of nobody. How do I make nobody disappear? Here is my message header now. Nobody [EMAIL PROTECTED] Using: mail ($to, $subject, $message, $header, '[EMAIL PROTECTED]'); -Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:19 AM To: 'Stut' Cc: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! PS mail ($to, $subject, $message, $header, '-f [EMAIL PROTECTED]'); doesn't work either. Still have nobody to deal with. As per being RFC compliant! -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:15 AM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] I have a problem with nobody! BSumrall wrote: > I have read about a -f function. > I tried > mail ($to, $subject, $message, -f$header); > mail -f($to, $subject, $message, $header); > > both result in parse error. Boy did you not read the documentation carefully! mail($to, $subject, $message, $headers, '[EMAIL PROTECTED]'); Go back and read http://php.net/function.mail properly. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I have a problem with nobody! SOLVED!
The last paragraph of the page Go figure! The appropriate code is; mail ($to, $subject, $message, $header = 'From: "Larry, Curly and Moe" <[EMAIL PROTECTED]>'); -Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:39 AM To: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! Let's take it one step further for arguments sake. What is I wanted to change "nobody" as the sender to, let's just say Larry or Curly, or Moe? Making message header as; Larry Shmuckatelli [EMAIL PROTECTED] Or Curly Shmuckatelli [EMAIL PROTECTED] Or Moe Shmuckatelli [EMAIL PROTECTED] What is the php driving force that controls the "who sent me" function? -Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:31 AM To: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! Well, I am now 1 step closer The php file do nor reference the importance of "having no spaces" between the -f and email address. [EMAIL PROTECTED] is key! But, still can't get rid of nobody. How do I make nobody disappear? Here is my message header now. Nobody [EMAIL PROTECTED] Using: mail ($to, $subject, $message, $header, '[EMAIL PROTECTED]'); -Original Message- From: BSumrall [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:19 AM To: 'Stut' Cc: php-general@lists.php.net Subject: RE: [PHP] I have a problem with nobody! PS mail ($to, $subject, $message, $header, '-f [EMAIL PROTECTED]'); doesn't work either. Still have nobody to deal with. As per being RFC compliant! -Original Message- From: Stut [mailto:[EMAIL PROTECTED] Sent: Sunday, June 17, 2007 12:15 AM To: BSumrall Cc: php-general@lists.php.net Subject: Re: [PHP] I have a problem with nobody! BSumrall wrote: > I have read about a -f function. > I tried > mail ($to, $subject, $message, -f$header); > mail -f($to, $subject, $message, $header); > > both result in parse error. Boy did you not read the documentation carefully! mail($to, $subject, $message, $headers, '[EMAIL PROTECTED]'); Go back and read http://php.net/function.mail properly. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php