samona Posted December 3, 2007 Share Posted December 3, 2007 Is there a way to show only the part of a form which has not yet been completed using php? For example, I have a form that is linked to a database, however, the fields of the form which have already been submitted successfully should not appear on the form again the next time the user tries to fill it out. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted December 3, 2007 Share Posted December 3, 2007 are you wanting a multiple page form or do you want correctly validated form fields not to be shown again when a validation error occurs? Quote Link to comment Share on other sites More sharing options...
revraz Posted December 3, 2007 Share Posted December 3, 2007 Sounds like they want the Form Input to not show up at all for those fields. Is there a way to show only the part of a form which has not yet been completed using php? For example, I have a form that is linked to a database, however, the fields of the form which have already been submitted successfully should not appear on the form again the next time the user tries to fill it out. Quote Link to comment Share on other sites More sharing options...
samona Posted December 3, 2007 Author Share Posted December 3, 2007 The form I'm looking to create is a form consisting of tasks. For example, If the user has already completed task #1, then when he opens the form again, it should not display task one again. Instead it will display task 2-n. Quote Link to comment Share on other sites More sharing options...
samona Posted December 3, 2007 Author Share Posted December 3, 2007 I think what I need to do is put a php conditional saying that if there is a value for this data field, then dont print that field. Does that make sense? Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted December 3, 2007 Share Posted December 3, 2007 yea like this <?php if(empty($_POST['name'])){ echo 'Name: <input type="text" name="name" size="20">'; } if(empty($_POST['email'])){ echo 'Email: <input type="text" name="email" size="20">'; } if(empty($_POST['message'])){ echo 'Message: <br><textarea rows="7" cols="20" name="message"></textarea>'; } ?> Quote Link to comment Share on other sites More sharing options...
samona Posted December 3, 2007 Author Share Posted December 3, 2007 I am reading the information from a database, so for example: In the table named Tasks I have the following records: Finished Homework | 5:00 PM Done Shopping | 6:00 PM Now in the form, since I have already completed these tasks, I don't want to have the option of selecting them. My code is <form action="checklist.php" method="post"> <input type="checkbox" name="task[1]" value="1">Finished Homework <input type="checkbox" name="task[2]" value="2">Done Shopping <input type="checkbox" name="task[3]" value="3">Watching TV <input type="submit" name="submit" /> Now, since the records Finished Homework and Done Shopping are already in the database, I don't want to give the user the option of checking those boxes again. So I thought maybe if I could keep them from being displayed that way they can't add a duplicate record for the same task. Am I even going about this the right way? Any help will be appreciated. Quote Link to comment Share on other sites More sharing options...
samona Posted December 3, 2007 Author Share Posted December 3, 2007 Does anyone know of an example checklist form? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.