Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7489093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:11:57+00:00 2026-05-29T15:11:57+00:00

EDIT: Mangling is fixed – primary issue appears to be the php/mysql connection In

  • 0

EDIT: Mangling is fixed – primary issue appears to be the php/mysql connection

In an attempt to learn how to use a MySQL db on a webpage, I’m following a basic tutorial for connecting to a MySQL instance via PHP (all managed through WAMP2)

The tutorial: http://www.freewebmasterhelp.com/tutorials/phpmysql/4 uses a PHP_SELF method (that I understand is now depreciated).

I’ve tried a few other suggestions that I’ve found doted around, but I can’t find resolution to the following error I see in the apache log:

(20024)The given path is misformatted or contained invalid characters: Cannot map POST /%3C$SEARCH.PHP%3E HTTP/1.1 to file, referer: http://localhost/search.php

This error prevents the HTML page from being returned, and I get a 403 error in my browser

It appears that this line of HTML/PHP is the culprit:

<form name="search" method="post" action="<?=$PHP_SELF?>">

I have seen suggestions that say to either turn on short_open_tag (a bad idea according to some), change the

<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 

I can’t get any of these methods to work, and wondered if anyone could let me know what dumb thing I’ve missed this time…

The whole php file I am using is:

<?php 
// // This is only displayed if they have submitted the form 
 if ($searching =="yes") 
 { 
 echo "<h2>Results</h2><p>"; 

 //If they did not enter a search term we give them an error 
 if ($find == "") 
 { 
 echo "<p>You forgot to enter a search term"; 
 exit; 
 } 

 include("dbinfo.php");
 mysql_connect($host,$username,$password);
 mysql_select_db("database") or die(mysql_error()); 

 // We preform a bit of filtering 
 $find = strtoupper($find); 
 $find = strip_tags($find); 
 $find = trim ($find); 

 //Now we search for our search term, in the field the user specified 
 $data = mysql_query("SELECT * FROM main WHERE upper($field) LIKE'%$find%'"); 

 //And we display the results 
 while($result = mysql_fetch_array( $data )) 
 { 
 echo $result['Item1']; 
 echo " "; 
 echo $result['Item2']; 
 echo "<br>"; 
 echo "<br>"; 
 } 

 //This counts the number or results - and if there wasn't any it gives them a little  message explaining that 
 $anymatches=mysql_num_rows($data); 
 if ($anymatches == 0) 
 { 
 echo "Sorry, but we can not find an entry to match your query<br><br>"; 
 } 

 //And we remind them what they searched for 
 echo "<b>Searched For:</b> " .$find; 
 } 
 ?> 


 <h2>Search</h2> 
 <form name="search" method="post" action="<?=$PHP_SELF?>">
 Seach for: <input type="text" name="find" /> in 
 <Select NAME="field">
 <Option VALUE="item1">Item1</option>
 <Option VALUE="item2">Item2</option>
 </Select>
 <input type="hidden" name="searching" value="yes" />
 <input type="submit" name="search" value="Search" />
 </form> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T15:11:58+00:00Added an answer on May 29, 2026 at 3:11 pm

    Avoid shortags, they are out of date, make sure to be using:

    <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    

    What does the form’s html look like when you load the page?

    EDIT:
    After reviewing my answer I’d like to rephrase it a bit, as they are not “out of date” per say, but they generally do cause problems (for those that don’t know how to set up php fully), so for beginners I’d suggest avoiding them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: Changed as I have a different issue with the same code 2nd Edit:
EDIT: changed the whole question sorry, im trying to deal with the mysql DATETIME
Edit: Made an official bug report at developers.Facebook.com GETing either of the following: graph.facebook.com/me/photos
Edit: Rewritting question I use the Project Management Library from http://dlhsoft.com/Home.aspx in my WPF
Edit 4: I was finally able to solve my own issue. See checkmark answer
[Edit: Apparently, this is only an issue for arrays and FoxyBOA's answer might direct
EDIT How to simplify the following code: if(x(a) > x(b)) s = b; e
EDIT After staring at this for 2 days, I do see one issue. I
Edit: This question was written in 2008, which was like 3 internet ages ago.
Edit: From another question I provided an answer that has links to a lot

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.