Jump to content

form not posting


raphael75

Recommended Posts

We have a Debian Linux server with Apache2. One page, feedback.php has a super-simple form:

 

 

 

<form action="feedback.php" method="post">
<div class="type"><input type="radio" name="type" id="compliment" value="compliment" /><label for="compliment">Compliment</label></div>
<div class="type"><input type="radio" name="type" id="complaint" value="complaint" /><label for="complaint">Complaint</label></div>
<div class="type"><input type="radio" name="type" id="general" value="general" /><label for="general">General</label></div>
<br />
<input type="submit" name="submit" class="begin_comments" value="Begin Comments" />
<br />
<br />
<br />
<span class="error"></span>
</form>

This form posts back to itself, and handles it like this:

 

 

PHP Code:


session_start();

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['type'])) {
$_SESSION['type'] = $_POST['type'];
//echo $_SERVER['REQUEST_METHOD'];
header('Location: form.php');
}
else {
$error = 'You must select a comment type to begin';
}
}


However, when form.php loads, $_POST, $_GET, or $_REQUEST are all empty arrays. What could cause this?

 

Thanks!

Link to comment
Share on other sites

However, when form.php loads, $_POST, $_GET, or $_REQUEST are all empty arrays. What could cause this?

 

 

The form.php is re-directed from feedback.php. $_POST won't have data because the form action is "feedback.php", but not "form.php". Since you use session, you may save the $_POST in session variable, then read it on form.php.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.