[PHP-DB] PHP Newbee Question
Hello All, I am new to PHP, and I am trying to design what I thought would be a fairly simple form, that queries a MYSQL database for two fields, (first, and last name). It should then return the entire results of the entry in the table. This part is actually 5 fields. If I run the script with static entries for first, and last, the process work flawlessly (as it should). If I try using variables for the search values, I do not receive any results. I have tried changing the form method from post, to get, and the problem continues. Any help would be greatly appreciated. Thank you. The first grouping is the html form, the second set is the php form that actually performs the search. Also the username, and password are populated in the actual script, I just took them out for the email. Thanks again. html headtitleContact lookup form/title/head body form action=test.php method=post First Name: input type=text name=firstbr Last Name: input type=text name=lastbr input type=submit value=lookup /form /body /html ?php define ('mysql_host', 'localhost'); define ('mysql_user', ''); define ('mysql_pass', ''); define ('mysql_db', 'chs'); if (! mysql_connect(mysql_host, mysql_user, mysql_pass) ) { die('Failed to connect to host ' . mysql_host . ' . '); } else { echo '' . mysql_host . 'br'; } mysql_select_db(mysql_db); if ($http_get_vars['first'] $http_get_vars['last']) { echo $http_get_vars['first'] . ' ' . $http_get_vars['last'] . 'br'; } $result=mysql_query(select * from chs where first='$first' or last='$last'); echo h2 align='center'Results/h2; while ($row = mysql_fetch_array($result)) { echo b{$row['first']}nbsp{$row['last']}nbspnbspnbsp{$row['branch']}nbspnbspnbsp{$row['extension']}nbspnbsp nbsp{$row['voice_mail']}nbspnbspnbsp{$row['position']}/b br; } ? Jeffrey Norsworthy MCP, CCNA Network Administrator Community Health Services [EMAIL PROTECTED]
Re: [PHP-DB] PHP Newbee Question
Variable names are case-sensitive in PHP - try $HTTP_POST_VARS[first] - or, for new versions of PHP, $_POST[first]. In another train of thoughts, please use the proper e-mail address - I'm sure I'm not the only one using filters to automatically move mail to folders and your although probably valid according to the RFC, the way you formatted the php list e-mail address doesn't match the filter names... Thanks! Bogdan Jeffrey Norsworthy wrote: Hello All, I am new to PHP, and I am trying to design what I thought would be a fairly simple form, that queries a MYSQL database for two fields, (first, and last name). It should then return the entire results of the entry in the table. This part is actually 5 fields. If I run the script with static entries for first, and last, the process work flawlessly (as it should). If I try using variables for the search values, I do not receive any results. I have tried changing the form method from post, to get, and the problem continues. Any help would be greatly appreciated. Thank you. The first grouping is the html form, the second set is the php form that actually performs the search. Also the username, and password are populated in the actual script, I just took them out for the email. Thanks again. html headtitleContact lookup form/title/head body form action=test.php method=post First Name: input type=text name=firstbr Last Name: input type=text name=lastbr input type=submit value=lookup /form /body /html ?php define ('mysql_host', 'localhost'); define ('mysql_user', ''); define ('mysql_pass', ''); define ('mysql_db', 'chs'); if (! mysql_connect(mysql_host, mysql_user, mysql_pass) ) { die('Failed to connect to host ' . mysql_host . ' . '); } else { echo '' . mysql_host . 'br'; } mysql_select_db(mysql_db); if ($http_get_vars['first'] $http_get_vars['last']) { echo $http_get_vars['first'] . ' ' . $http_get_vars['last'] . 'br'; } $result=mysql_query(select * from chs where first='$first' or last='$last'); echo h2 align='center'Results/h2; while ($row = mysql_fetch_array($result)) { echo b{$row['first']}nbsp{$row['last']}nbspnbspnbsp{$row['branch']}nbspnbspnbsp{$row['extension']}nbspnbsp nbsp{$row['voice_mail']}nbspnbspnbsp{$row['position']}/b br; } ? Jeffrey Norsworthy MCP, CCNA Network Administrator Community Health Services [EMAIL PROTECTED] Mail scanat cu RAV Antivirus! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Newbee Question
Thanks for the tip. Unfortunately it didn't fix the issue. I am sorry about the way the address message is displayed. There unfortunately isn't anything I can do about it. Jeffrey Norsworthy MCP, CCNA Network Administrator Community Health Services [EMAIL PROTECTED] Bogdan Stancescu [EMAIL PROTECTED] 07/02/02 10:15AM Variable names are case-sensitive in PHP - try $HTTP_POST_VARS[first] - or, for new versions of PHP, $_POST[first]. In another train of thoughts, please use the proper e-mail address - I'm sure I'm not the only one using filters to automatically move mail to folders and your although probably valid according to the RFC, the way you formatted the php list e-mail address doesn't match the filter names... Thanks! Bogdan Jeffrey Norsworthy wrote: Hello All, I am new to PHP, and I am trying to design what I thought would be a fairly simple form, that queries a MYSQL database for two fields, (first, and last name). It should then return the entire results of the entry in the table. This part is actually 5 fields. If I run the script with static entries for first, and last, the process work flawlessly (as it should). If I try using variables for the search values, I do not receive any results. I have tried changing the form method from post, to get, and the problem continues. Any help would be greatly appreciated. Thank you. The first grouping is the html form, the second set is the php form that actually performs the search. Also the username, and password are populated in the actual script, I just took them out for the email. Thanks again. html headtitleContact lookup form/title/head body form action=test.php method=post First Name: input type=text name=firstbr Last Name: input type=text name=lastbr input type=submit value=lookup /form /body /html ?php define ('mysql_host', 'localhost'); define ('mysql_user', ''); define ('mysql_pass', ''); define ('mysql_db', 'chs'); if (! mysql_connect(mysql_host, mysql_user, mysql_pass) ) { die('Failed to connect to host ' . mysql_host . ' . '); } else { echo '' . mysql_host . 'br'; } mysql_select_db(mysql_db); if ($http_get_vars['first'] $http_get_vars['last']) { echo $http_get_vars['first'] . ' ' . $http_get_vars['last'] . 'br'; } $result=mysql_query(select * from chs where first='$first' or last='$last'); echo h2 align='center'Results/h2; while ($row = mysql_fetch_array($result)) { echo b{$row['first']}nbsp{$row['last']}nbspnbspnbsp{$row['branch']}nbspnbspnbsp{$row['extension']}nbspnbsp nbsp{$row['voice_mail']}nbspnbspnbsp{$row['position']}/b br; } ? Jeffrey Norsworthy MCP, CCNA Network Administrator Community Health Services [EMAIL PROTECTED] Mail scanat cu RAV Antivirus! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] PHP Newbee Question
It was fine this time! Your first message was addressed to [EMAIL PROTECTED] instead of simply [EMAIL PROTECTED] Well, make sure you don't use POST in the form and GET in the PHP - or vice-versa. Also, try replacing your debug code in the PHP with something like this: -- echo (bDebug:/bp\n); echo(First: .$_POST[first].; Last: .$_POST[last].br\n); echo(hr\n); -- This way you can fiddle with a single line of code until you get it working, instead of risking to make a mistake either when testing or when printing. Bogdan Jeffrey Norsworthy wrote: Thanks for the tip. Unfortunately it didn't fix the issue. I am sorry about the way the address message is displayed. There unfortunately isn't anything I can do about it. Jeffrey Norsworthy MCP, CCNA Network Administrator Community Health Services [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] Bogdan Stancescu [EMAIL PROTECTED] 07/02/02 10:15AM Variable names are case-sensitive in PHP - try $HTTP_POST_VARS[first] - or, for new versions of PHP, $_POST[first]. In another train of thoughts, please use the proper e-mail address - I'm sure I'm not the only one using filters to automatically move mail to folders and your although probably valid according to the RFC, the way you formatted the php list e-mail address doesn't match the filter names... Thanks! Bogdan Jeffrey Norsworthy wrote: Hello All, I am new to PHP, and I am trying to design what I thought would be a fairly simple form, that queries a MYSQL database for two fields, (first, and last name). It should then return the entire results of the entry in the table. This part is actually 5 fields. If I run the script with static entries for first, and last, the process work flawlessly (as it should). If I try using variables for the search values, I do not receive any results. I have tried changing the form method from post, to get, and the problem continues. Any help would be greatly appreciated. Thank you. The first grouping is the html form, the second set is the php form that actually performs the search. Also the username, and password are populated in the actual script, I just took them out for the email. Thanks again. html headtitleContact lookup form/title/head body form action=test.php method=post First Name: input type=text name=firstbr Last Name: input type=text name=lastbr input type=submit value=lookup /form /body /html ?php define ('mysql_host', 'localhost'); define ('mysql_user', ''); define ('mysql_pass', ''); define ('mysql_db', 'chs'); if (! mysql_connect(mysql_host, mysql_user, mysql_pass) ) { die('Failed to connect to host ' . mysql_host . ' . '); } else { echo '' . mysql_host . 'br'; } mysql_select_db(mysql_db); if ($http_get_vars['first'] $http_get_vars['last']) { echo $http_get_vars['first'] . ' ' . $http_get_vars['last'] . 'br'; } $result=mysql_query(select * from chs where first='$first' or last='$last'); echo h2 align='center'Results/h2; while ($row = mysql_fetch_array($result)) { echo b{$row['first']}nbsp{$row['last']}nbspnbspnbsp{$row['branch']}nbspnbspnbsp{$row['extension']}nbspnbsp nbsp{$row['voice_mail']}nbspnbspnbsp{$row['position']}/b br; } ? Jeffrey Norsworthy MCP, CCNA Network Administrator Community Health Services [EMAIL PROTECTED] Mail scanat cu RAV Antivirus! -- PHP Database Mailing List (http://www.php.net/) http://www.php.net/%29 To unsubscribe, visit: http://www.php.net/unsub.php Mail scanat cu RAV Antivirus! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php