Click to See Complete Forum and Search --> : PHP scripting
dennic
09-13-2004, 02:29 AM
im new to php so heres a basic question for you, hope it makes sense.
im designing a website with php, im wanting to have a search form on the index page, do i create the script with a separate file, say search.php and just include that in the home page, index.htm when you call the form.
or can you include the php script within the whole page?
Stephen Philbin
09-13-2004, 02:54 AM
You just write your php in with your html.
dennic
09-13-2004, 07:02 AM
ok, so that means that anyone can view the source code for the php cant they?
solavar
09-13-2004, 07:18 AM
No one can view the source code of your PHP.
That's the beauty of it!
When someone requests a page that has a .php extension, the webserver reads the source code and constructs a .html file which is then sent to the browser.
bestwebauctions
09-13-2004, 07:40 AM
create the script with a separate file, say search.php and
I find it easier to change things if I use the content of a page as incuded, in my html / php it's easier to change them on they fly than to build several pages.
These are all the lines I use in an "index.php" page.
<?
error_reporting(0);
include ('headder.php');
include ('body.php');
include ('footer.php');
?>
Hellspire
09-13-2004, 10:35 AM
I shall point out the fairly obvious. If you wish to use your search engine with php on any file of your site, you will need to rename all their extensions with .php (if the processing of the form is done on that page itself, even then it is simpler to do it the way i will now mention) or have the form action go to an external file that will process the form, search and appropriate results and if you have an exact match option, you could direct them back to the html page in question. Note that the only way to make your site searchable is to either use the file read functions or to build a search index yourself. *scratches head*
Also if i may point out, php does not produce a .html page, I dont know who told anyone that, but what it does is parse the php information, and return the output of the file (script,html,text, and otherwise) to the browser. Categorizing it as an html processer is a severly limited assumption =p. :confused: ;)
Good luck.