How to resolve a Fatal Error

entering a search term and clicking on Search generates a fatal error

Page 1 of 1

5 Replies - 2581 Views - Last Post: 18 August 2009 - 12:08 PM Rate Topic: -----

#1 ready2drum  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 5
  • Joined: 23-October 08

How to resolve a Fatal Error

Posted 18 August 2009 - 09:11 AM

After entering a search term and clicking on the 'search' button, the following error message appears:
_________
Notice: Undefined index: query in E:\Inetpub\wwwroot\Intranet_Old\intranet\jha\jha_doc_results.php on line 62

Fatal error: Uncaught exception 'com_exception' with message 'Parameter 0: Type mismatch. ' in E:\Inetpub\wwwroot\Intranet_Old\intranet\jha\jha_doc_results.php:62 Stack trace: #0 E:\Inetpub\wwwroot\Intranet_Old\intranet\jha\jha_doc_results.php(62): unknown() #1 {main} thrown in E:\Inetpub\wwwroot\Intranet_Old\intranet\jha\jha_doc_results.php on line 62

<td class="fstyle_5"><form id="form1" name="form1" method="post" action="jha_doc_results.php">
_________

See code below for line 62 details:
__
								<p>
									  <input name="query" type="text" class="fstyle_5" id="query" size="60" /> 
									  <input name="Submit" type="submit" class="fstyle_1" value="Search" />
									</p>
<?php
					$Q = new COM("ixsso.Query");
					$util = new COM("ixsso.util");
					$Q->Catalog = "\\cbva006file1\GROUP\Safety\jha";
(line 62)					$Q->Query = $_POST["query"];
					$Q->Columns = "filename, rank, vpath, path, DocTitle, characterization, All";
					$Q->SortBy = "rank[d]";
					$Q->MaxRecords = 200;
					$fileRS = $Q->CreateRecordSet("nonsequential");
					if(!$fileRS->RecordCount == 0) {	
						$fileRS->MoveFirst();
					}
					while($i < $fileRS->RecordCount) {	
					?>
					<div id="search_results">
						  <table width="100%" border="0" cellpadding="0">
							<tr>
							  <td height="20" class="fstyle_4"><?php echo($fileRS->fields['DocTitle']->value); ?></td>
							</tr>
							<tr>
							  <td class="fstyle_5"><a href="<?php echo($fileRS->fields['path']->value); ?>"><?php echo($fileRS->fields['filename']->value); ?></a></td>
							</tr>
							<tr>
							  <td class="fstyle_5"><?php echo($fileRS->fields['characterization']->value); ?></td>
							</tr>
							<tr>
							  <td class="fstyle_5"><hr /></td>
							</tr>
						  </table>
					  </div>
					<?php 
						$fileRS->MoveNext();
						$i++;
						} 
					?>			
					</td>
				  </tr>
			</table>
	  </div>
	<div id="footer"></div>
</div>
</body>
</html>
								   
									  </form>


__
EDIT: Please remember to use [ code ] tags! CTphpnwb


I've tried several different tactics to resolve this error without success.

Your guidance and assistance is greatly appreciated!

This post has been edited by CTphpnwb: 18 August 2009 - 09:19 AM


Is This A Good Question/Topic? 0
  • +

Replies To: How to resolve a Fatal Error

#2 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3030
  • Posts: 10,567
  • Joined: 08-August 08

Re: How to resolve a Fatal Error

Posted 18 August 2009 - 09:18 AM

You haven't set the form to post, so it should use get by default. That means that $_POST['query'] will not be set.
Was This Post Helpful? 0
  • +
  • -

#3 ready2drum  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 5
  • Joined: 23-October 08

Re: How to resolve a Fatal Error

Posted 18 August 2009 - 10:03 AM

as for setting the form to post, I'm not sure how that should look or where to place the code so that it does post...as this is my first time setting something like this up....do you have any suggestions or examples of how to set a form to post? Thank you for your timely response to this issue.
Was This Post Helpful? 0
  • +
  • -

#4 RPGonzo  Icon User is offline

  • // Note to self: hmphh .... I forgot
  • member icon

Reputation: 151
  • View blog
  • Posts: 954
  • Joined: 16-March 09

Re: How to resolve a Fatal Error

Posted 18 August 2009 - 11:40 AM

Actually from your code your form IS set to use post

<form id="form1" name="form1" method="post" action="jha_doc_results.php">



the attribute method is what sets it, what you may try do do is at the head of the form do a var_dump on your $_POST array and see what IS being set ... or just do a little error checking in the form directly ...

if (isset($_POST['query']) && $_POST['query'] != "") {
   $Q->Query = $_POST["query"];
} else {
   die ("No search term defined please try again.");
}



the var_dump method is simplex at the head inside your php tag just add

var_dump($_POST);



it will show you every value and key set in the post array
Was This Post Helpful? 0
  • +
  • -

#5 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3030
  • Posts: 10,567
  • Joined: 08-August 08

Re: How to resolve a Fatal Error

Posted 18 August 2009 - 12:00 PM

View PostRPGonzo, on 18 Aug, 2009 - 02:40 PM, said:

Actually from your code your form IS set to use post

Oops! I missed that when I inserted the code tags. I guess it just goes to show how important it is to use them when posting.
;)
Was This Post Helpful? 0
  • +
  • -

#6 ready2drum  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 5
  • Joined: 23-October 08

Re: How to resolve a Fatal Error

Posted 18 August 2009 - 12:08 PM

That's great information to know...I really appreciate your help. I will try both examples and reply back to this forum topic to let you know the results as soon as possible. Thanks!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1