Forum Moderators: phranque

Message Too Old, No Replies

How to set a 204 error resonse.

         

MartinWeb

11:44 pm on Oct 13, 2009 (gmt 0)

10+ Year Member



I have read that to make a form update a database but stay on the same page, you can use a 204 error. How do I set one?
Thanks in advance.

phranque

12:33 am on Oct 14, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



your http 204 No Content [w3.org] response should contain the http header(s) but no html document.

using a perl script for example, your complete http response could be generated with:

print "Status: 204 No Content\n\n";

MartinWeb

12:45 am on Oct 14, 2009 (gmt 0)

10+ Year Member



Can you please explain a bit more? I never have used pearl, I mainly use PHP, MySQL, JS, HTML, and CSS. Thanks.

phranque

1:58 am on Oct 14, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



i'm pretty sure the exact same syntax will work for php.

MartinWeb

2:05 am on Oct 14, 2009 (gmt 0)

10+ Year Member



It doesn't look like it. When I tried that code, it visibly printed "Status: 204 No Content", and stayed on the page.

phranque

4:59 am on Oct 14, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



try sending a raw HTTP header [php.net].

MartinWeb

7:22 pm on Oct 14, 2009 (gmt 0)

10+ Year Member



It works, thank you so much!