php - Unable to submit form in 404 page


I created a custom 404 page. In custom 404 page i placed a report broken link form . it is very simple form . But when i try to submit the form it is not working , i am not getting any values in post

headers :    
    [REDIRECT_STATUS] => 404
    [REQUEST_URI] => /mobiles/hd-s-phones-price-list.html 
    [SCRIPT_NAME] => /custom404.php 
    [PHP_SELF] => /custom404.php 

here is the code


RewriteEngine On
ErrorDocument 404 /custom404.php


<div >
    <b>Tell Us To Fix This Broken Link </b>
    <div >       
    <form name="custom_404" action="<?php HTTP.'custom404.php'; ?>" method="post">
      <input type="hidden" name="uri" value="<?php echo $_SERVER['REQUEST_URI']; ?>" />
      <br />
      <label>What you are looking for</label>
      <br />
      <input type="text" name="looking" value="" />      
      <br />
      <input type="text" name="name" value="<?php echo $_SESSION['visitorname']!='' ? $_SESSION['visitorname'] : ''; ?>" />    
      <br />
      <input type="email" name="email" value="<?php echo $_SESSION['visitoremail']!='' ? $_SESSION['visitoremail'] : ''; ?>">
      <label>We will Mail You the exact links you are looking for</label>
      <br />
      <input type="submit" name="submit_error" value="Report us" />



<?php print_r($_POST); ?>

Result i am getting when i print post is just emptyarray()




You are missing an echo in

<form name="custom_404" action="<?php HTTP.'custom404.php'; ?>" method="post">

which results in action="".

Your code should look like this:

<form name="custom_404" action="<?php echo HTTP.'custom404.php'; ?>" method="post">



If you have to submit the form on the same page then let the action will be blank. It will be posted on the same url.

<form name="custom_404" action="" method="post">

This will also work.

People are also looking for solutions to the problem: .htaccess - PHP redirect to a link in URL


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.