Uninitialized $_POST variables
Posted: Wed May 25, 2005 3:24 pm
Hello all, I'm new both to this community, to php, and scripting languages in general and I've encountered a situation that I'm sure many others have encountered as well, but I've yet to find any information that addesses it. If this is something that has been posted elsewhere and I've missed it, please forgive me. I've run some searches but haven't come up with anything.
So, I have a page that is both the query and results page. The query searches for books in a library database and displays the results. The problem is that I'm using $_POST[""] variables to get the query parameters and the results page is the same page as the query page. This is giving me a warning message that the variable doesn't exist when the page first loads and a query has yet to be performed:
The code that generates the query (for now):
Thanks for any help!
Gabe
So, I have a page that is both the query and results page. The query searches for books in a library database and displays the results. The problem is that I'm using $_POST[""] variables to get the query parameters and the results page is the same page as the query page. This is giving me a warning message that the variable doesn't exist when the page first loads and a query has yet to be performed:
Does anyone know how I can perform a check to see if a POST method has been executed before attempting to access the $_POST[""] variables or if that isn't possible, if there is a way to suppress that error so it isn't written to the page?Notice: Undefined index: query in E:\Inetpub\WWWRoot\testing\aq-db\query.php on line 72
The code that generates the query (for now):
Code: Select all
<?php
if($_POSTї"e;query"e;] != null){
$connectionstring = odbc_connect("e;Allacquistions"e;, "e;"e;, "e;"e;);
$queryStr = $_POSTї"e;query"e;];
$searchOpt = $_POSTї"e;search-option"e;];
$Query = "e;SELECT * FROM AllFields WHERE ($searchOpt LIKE '%$queryStr%' ) ORDER BY TITLE ASC"e;;
//...irrelevent code removed...
odbc_close($connectionstring);
}
?>Gabe