1568 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • India
  • Referred between 1 and 9 users
  • Sold between 100 and 1 000 dollars
rahulbist says

hi everyone,

I am facing a strange error.

I have made a html form

<form action=”test.php” method=”POST”> Name: <input type=”text” name=”nameval” />

<input type=”submit” /> </form>

the “test.php” file is in the same directory in which is the above html page. but when I press “submit” on html page, it shows me “not_found.html”. it indicates that the html page didn’t found the php file.

how can this happen? any idea?

please help me.

thanks in advance.

367 posts plop
  • Elite Author
  • Sold between 50 000 and 100 000 dollars
  • Beta Tester
  • Has been a member for 5-6 years
  • Grew a moustache for the Envato Movember competition
  • Referred between 50 and 99 users
  • Interviewed on the Envato Notes blog
+3 more
kimonoThemes says

Strange indeed.

And what about ”/test.php” or “http://www.the-whole-url.com/test.php” ?

499 posts
  • Canada
  • Exclusive Author
  • Sold between 1 000 and 5 000 dollars
  • Has been a member for 5-6 years
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
TutelageSystems says

Strange indeed. And what about ”/test.php” or “http://www.the-whole-url.com/test.php” ?

Definitely try the entire URL just in your browser. Also ensure that your host isn’t doing anything when you view the source of your page; Just to ensure that it is actually still the right file name.

1568 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • India
  • Referred between 1 and 9 users
  • Sold between 100 and 1 000 dollars
rahulbist says

the php.ini file is in the public_html folder. is this a problem?

296 posts
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 4-5 years
  • Exclusive Author
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
  • United States
CodeFusion says

Typically, no. That is not a problem; however, depending on your server configuration, it could cause issues, but usually a Internal Server Error 5XX.

To see if the php.ini is indeed causing you trouble you can temporarily rename it to php.inx and try your form and see what happens.

The code you posted above, is that the only code on that page? Your form is set to send the POST info to test.php, but if you are getting an error that states “not_found.html” is not found, then it seems like something is intercepting your submit request – my guess, javascript.

Another possibility is that your test.php page is trying to include a “not_found.html” page that does not exist.

If you can post the full source code of both pages it will eliminate a bunch of guess work.

Bradley

1568 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • India
  • Referred between 1 and 9 users
  • Sold between 100 and 1 000 dollars
rahulbist says

Typically, no. That is not a problem; however, depending on your server configuration, it could cause issues, but usually a Internal Server Error 5XX. .......

hi codefusion,

it was a testing code. nothing else is in the html file.

html code is :

<!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”> <head> <meta name=”generator” content= “HTML Tidy for Linux/x86 (vers 11 February 2007), see www.w3.org” /> </head>

<title></title>

<form action=”test.php” method=”post”> Name: <input type=”text” name=”ttxt” /> <input type=”submit” /> </form>

php code :

<?php

$video_url = $_POST[“ttxt”];

echo $video_url;

?>

I don’t know what is happening :?

1568 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • India
  • Referred between 1 and 9 users
  • Sold between 100 and 1 000 dollars
rahulbist says

sorry double post :(

296 posts
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 4-5 years
  • Exclusive Author
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
  • United States
CodeFusion says

I copied and pasted [fixing the quote marks of course] the code you posted above into two blank pages on my server and it executed just fine.

Here lets give this a shot.
Delete everything in your test.php file then copy and paste all of the following code in there:

<!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">
<head>
<title>Test</title>
</head>

<?php
echo "PHP is working<br /><br />";
if (isset($_POST["ttxt"])) {
echo '<h3>$_POST["ttxt"] was succfully posted.<br />You entered: <strong>'.$_POST["ttxt"].'</strong></h3>';
} else {
if (!empty($_POST)) {
echo 'Debugging POST data';
echo '<pre>';
print_r($_POST);
echo '</pre>';
}//end debug
}//end post ttxt not set
?>
<form action="" method="post">
Name: <input type="text" name="ttxt" />
<input type="submit" />
</form>

load it in your browser and give it a try.

It should say “PHP is working” just above the form; if not, your going to have a headache ;)

by leaving the “action” property blank in the form, it will post to “itself”. This will eliminate the page hop.

Let me know how it goes.

1568 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 6-7 years
  • India
  • Referred between 1 and 9 users
  • Sold between 100 and 1 000 dollars
rahulbist says

hi codefusion,

thanks for the code. :)

here is the output :-

it shows “php is working” in beginning.

when I add some text like ‘my test’. it shows

$_POST[“ttxt”] was succfully posted. You entered: my test.

but , when I add some url like “http://youtu.be/CeGPapZFdUU”.

it again shows not_found.html

I need to add url.

if you know, why this problem is happening, please help me.

I will be very thankful to you :)

296 posts
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 4-5 years
  • Exclusive Author
  • Bought between 50 and 99 items
  • Referred between 1 and 9 users
  • United States
CodeFusion says

That is very odd!!

It sounds like something is intercepting your POST request and trying to manipulate it. The only thing I can really think of with the power to do that is .htaccess and/or php.ini

You should call your hosting provider tech support and ask them for help. But beings as you been dealing with this for three days now, I’m get the feeling that tech support is not an option.

If you cannot use tech support here’s what to try:

Before we get to much deeper into this, edit your test.php and change the form from a method=”post” to method=”get”. In the PHP bit, change all occurrences of $_POST to $_GET and try submitting the url in my form again. Whether it works or is broke, change all the gets back to posts as forms should rarely be submitted via “get”.
This quick test will tell us if something is intercepting just POST requests or both POST and GET requests. Not that its particularly helpful, but it only takes a second to try.

Do you have any files called ”.htaccess” on your server? They may be in the same directory or a parent directory. Depending on your FTP program, they could be hidden. If you do find one, temporarily rename them to .htaccess_x or something. Also rename your php.ini to php.inx or something and try my form again.

If you are able to use my form and POST your youtu.be url, then you know its a problem with .htaccess or php.ini
If you still get the same error you will need to contact your hosting provider as there is little else that can be done from our end.

Here’s how to figure out which file is causing the problem
If your url POSTed, then restore the name of your php.ini file and try the form again.
If it works, that means your .htaccess file is the problem. Edit your htaccess file and see whats going on in there.
If it does not work, temporarily rename php.ini to php.inx (again) and restore the .htaccess name and try the form again. If it works, then your php.ini file is the problem. Edit php.ini to see whats going on in there.

One thing to note is that playing around with your .htaccess / php.ini can lead to some problems as some hosting companies use them like duct-tape/gaffers-tape and band-aids to hold everything together. So have your hosting company’s tech support number handy just in case.

If one or both of the files is causing the issue, copy and paste them in an email to me via my profile page and I will take a look at them.

Bradley

by
by
by
by
by
by