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
https://forums.phpfreaks.com/topic/274527-form-not-posting/
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
https://forums.phpfreaks.com/topic/274527-form-not-posting/#findComment-1412638
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.