Failing to post a textarea with <br> in it
Moderator: General Moderators
Failing to post a textarea with <br> in it
I have changed hosts and my (previously-working) php code is now failing.
Basically I have a very simple
<form action='../cgi-bin/preview.pl' method=post>
<textarea name='textx'></textarea>
</form>
All is fine if I just enter simple words into the textarea. However if I enter 'gggh<br>fsdafgjsa' for example, it just seems to crumble in a heap! the perl script does not even get called and I jump back to the index page of the website. It seems that the post is just not working. Any ideas? I have tried replacing the action but still the same - it just doesn't seem to be getting that far.
Host is linux, php version 4.4.3
Any help appreciated - it's driving me mad!
Basically I have a very simple
<form action='../cgi-bin/preview.pl' method=post>
<textarea name='textx'></textarea>
</form>
All is fine if I just enter simple words into the textarea. However if I enter 'gggh<br>fsdafgjsa' for example, it just seems to crumble in a heap! the perl script does not even get called and I jump back to the index page of the website. It seems that the post is just not working. Any ideas? I have tried replacing the action but still the same - it just doesn't seem to be getting that far.
Host is linux, php version 4.4.3
Any help appreciated - it's driving me mad!
-
blackbeard
- Forum Contributor
- Posts: 123
- Joined: Thu Aug 03, 2006 6:20 pm
Why perl?
Sorry, can you explain a bit more about the perl comment (or point me in the right direction). I obviously don't understand where the error is - I have tried changing the action to 'x.html' where x.html is a simple bit of text to display and even that doesn't work as soon as I type in <br> within the input string. Have also tried changing the textarea to <input> and it still fails then.
It's as if whatever is trying to post the variables is just failing when there is a '<br>' in the string., but I don't know how to find out exactly what is failing and what to change....
It's as if whatever is trying to post the variables is just failing when there is a '<br>' in the string., but I don't know how to find out exactly what is failing and what to change....
-
blackbeard
- Forum Contributor
- Posts: 123
- Joined: Thu Aug 03, 2006 6:20 pm
It is a script I wrote, but the problem is not with the script! For example, I can chmod the permissions on (or even delete) the script, and if I try to POST a varible from the php with a '<br>' somewhere in the script, it just jumps straight to the site's index page. If I POST a variable from the php with no '<br>' then I get the expected result - file not found or server permissions. I'm sure it has to do with my new host's set up - this code was working absolutely fine for 2 years on my previous host.... They are both using the same versions of php/apache etc so I think it colud be a php ini problem, but I've got no idea what to check/how to even debig this error...
Thanks for your time
Thanks for your time
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
You will need to post more code or something more tangible. At this point, it's just not possible to guess at a culprit.
More than likely, it has nothing to do with PHP. PHP doesn't care what's in the submission content. Your host may have some filtering (like a security filter) that may be blocking it. Have you talked to them?
More than likely, it has nothing to do with PHP. PHP doesn't care what's in the submission content. Your host may have some filtering (like a security filter) that may be blocking it. Have you talked to them?
Everah | Please use
j.php:
Running source - if type dsgakgfkdasj into input, hit submit, get 'It worked' (as expected)
If type in gfadskg<br>hfsakhjkfas, hit submit - get taken to home page of site with no error logging or hints as to what has happened...
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
This is the simplest code that illustrates what is happening:
source file:Code: Select all
<?php header("Content-type: text/html; charset=iso-8859-1") ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang=en>
<head>
</head>
<body>
<form action="j.php" method=post>
<input name="test"></input>
<input type=submit Value="Preview"></input>
</form>
</body>
</html>Code: Select all
<?php header("Content-type: text/html; charset=iso-8859-1") ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang=en>
<head>
</head>
<body>
It worked
</body>
</html>Running source - if type dsgakgfkdasj into input, hit submit, get 'It worked' (as expected)
If type in gfadskg<br>hfsakhjkfas, hit submit - get taken to home page of site with no error logging or hints as to what has happened...
Everah | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]- maliskoleather
- Forum Contributor
- Posts: 155
- Joined: Tue May 15, 2007 2:19 am
- Contact:
-
blackbeard
- Forum Contributor
- Posts: 123
- Joined: Thu Aug 03, 2006 6:20 pm
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
If request data is breaking server side processing I would guess the server is the place to check first. If you enter a <br> and neither the perl script nor the PHP script get called, then something is happening before to the call to the processing on those pages. Since both perl and PHP sit on the server, I would suspect it has something to do with the server.
Server anti-spam utility to blame
Turns out the ISP has anti-spam/anti-hacking code switched on by default to stop anything which could be embedded html being input.
Thanks everyone for your helpful suggestions and at least I know that my code wasn't to blame!
Thanks everyone for your helpful suggestions and at least I know that my code wasn't to blame!