Page 1 of 1

Form not saving data

Posted: Tue Jun 24, 2008 9:23 am
by ajcether
Hi there, I have a problem with a form I want to use on my site. The form's supposed to be a feedback form. There are fields for name, email, comments, then the submit buttom. When the submit is clicked, a page appears displaying what they've entered in the form (checking that their submission is what they want). This page is the preview page.

It would seem that the information entered in the original form is not being sent to the preview page because all the fields are blank when they should repeat what was initially entered. Here is the code:

Code: Select all

 
 
index.php:
 
$fb = new Feedback;
         
    if (isset($_POST['action'])) {
            
        $fb->name = $_POST['name'];
 
       if ($fb->valid()) {
            $_SESSION['feedback'] = $fb;
            return header('Location: ?action=preview');
        }
            
    }elseif ($_SESSION['feedback']) { // Coming back from preview
         $fb = $_SESSION['feedback'];
    }          
 
    $this->feedback = $fb;
    $this->render('views/show_form.php');
}
 
 
show_form.php:
 
<? $feedback = $this->feedback; ?>
 
<form method="post" action="index.php">
 
<label for="name" ><strong>Your Name:</strong></label> 
<input type="text" class="text" name="name" id="name" size="30" value="<?= $feedback->name ?>" /><br/>
 
<input type="hidden" name="action" value="form" />
<input type="submit" value="Preview" />
</form>
 
preview.php:
<? $feedback = $this->feedback; ?>
<ul>
<li>Name: <?= $feedback->name ?></li>
</ul>
<form action="" method="post">
<input type="submit" class="submit" value="Send Feedback Now" />
<input type="hidden" name="action" value="send"/>
</form>
 

Please help me with this...I don't get why it isn't storing what's in the form...it was working before and I don't know what happened.

Re: Form not saving data

Posted: Tue Jun 24, 2008 5:10 pm
by WebbieDave
Not familiar with the Feedback class. You'll want to refer to the class's documentation and/or find out if the authors offer a forum for it.