View Full Version : Help with Php includes

09-25-2008, 03:11 AM
Im trying to figure out how to place a php include link within a html form, so that once your hit submit, it just loads the results in a include.

this is the code...

<form action="main.php?section=results" id="cse-search-box">
<div align="right">
<input type="hidden" name="cx" value="partner-pub-0730517514905995:z1dlz0-b5x4" />
<input type="hidden" name="cof" value="FORID:10" />
<input type="hidden" name="ie" value="ISO-8859-1" />
<input type="text" name="q" size="31" />
<input type="submit" name="sa" value="Search" />
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&amp;lang=en"></script>

This is the site, and the result page.


once you hit the search button, it just takes me to a blank page. Can anyone help?

09-25-2008, 11:33 AM

Looks to me that you have corrected called the PHP script upon the submission of the form, sounds me that you have not written or echoed anything on results.php that is why you are not getting any output. If you can show me what you are writing in results.php I might be able to assist better.



Lexolution IT Services
Web Design Services (http://www.lexolutionit.com)

09-25-2008, 11:42 AM
PHP Includes are not like frames, or javascript. While frames just make a frame:

<frame scr="blah" />

They do not take the code FROM the frame and PUT it in the document, they just take the frame tag, as a copy tag. The php include() will take something from another document and then put it in the document that you've put the include() in. And it will not change - unless there is dhtml in the included page. My answer to you is Ajax.
I cannot help you with that part. Try searching dynamicdrive.com for ajax.

09-25-2008, 04:24 PM
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<body><div id="cse-search-results"></div>
<script type="text/javascript">
var googleSearchIframeName = "cse-search-results";
var googleSearchFormName = "cse-search-box";
var googleSearchFrameWidth = 820;
var googleSearchDomain = "www.google.com";
var googleSearchPath = "/cse";
<script type="text/javascript" src="http://www.google.com/afsonline/show_afs_search.js"></script>