When I submit my form; the resultant page seems to output just raw php code rather than actually executing. the funny thing is, if I just run my code and hard code the $_get array values it works a charm I’m running this on a virtual server (Xampp) if that helps.
*The related get code *
$search = $_GET['searcharg'];
The form:
<form action="search.php" method="get">
Search:<input type="text" name="searcharg" /><br />
<input type="submit" value="Submit" />
</form>
Any help would be appreciated.
Give you only posted one line, a few basic items.
First up are you using the opening and closing php tags?
If not, they are needed.
Next make sure you are using
http://localhostto access the file and that you are not accessing it using thefile:///etcetcetcversion (as catfish hinted to). As it has to be ran through the Apache server in order to be handled properly.If you are, then the issue will most likely lay within Apache not setup properly to handle the
.phpextension, but xampp should handle that for you. So try the above option and see how that goes. If it is the problem that apache is not recognizing the.phpextension, you can add this to yourhttpd.confand then restart apache and it should kick it into gear:AddType application/x-httpd-php .php