view results of forms

  • buzzby365
  • Proficient
  • Proficient
  • buzzby365
  • Posts: 288

Post 3+ Months Ago

i woiuld like to view the result of forms that have been submitted. viewing a form submission via columns and rows isnt the problem. what is the problem is that i would like to view the form submissions via the same form template that was used to submit the form. i know that all the fields would be like
PHP Code: [ Select ]
echo $_post['name'];
for the name fields and similar for all the other fields that i want to see the results from. but what makes this results page unique is this. i want to have a 3 buttons: 'NEXT' 'PREVIOUS' 'UPDATE'. the NEXT button would go to the next form. the PREVIOUS button would go to the previous form and the UPDATE button would update any fields that are filled in on that page. the reference number is the id that separates one set of results from another. the NEXT and PREVIOUS buttons are like that found on a guestbook whereby you can read the next submission or previous submission. the UPDATE button updates the form when a field is completed. help with this would be brilliant. i would like to know how to start this off
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

The way I understand your question is that you want to be able to page through your database and have the form automatically updated with the information on that record. Then you want to be able to make changes and save the changes.

From the above it is actually quiet easy.

Check out this article - he uses the SQL LIMIT call and it is probably the most effective way to do it

Code: [ Select ]
$nextPageID = "SELECT primary_key FROM table LIMIT 2,1"
$previousPageID = "SELECT primary_key FROM table LIMIT 0,1"
$currentPageID = "SELECT primary_key FROM table LIMIT 1,1"
  1. $nextPageID = "SELECT primary_key FROM table LIMIT 2,1"
  2. $previousPageID = "SELECT primary_key FROM table LIMIT 0,1"
  3. $currentPageID = "SELECT primary_key FROM table LIMIT 1,1"


http://www.sitepoint.com/article/php-pa ... ult-sets/5

Good luck and I just learnt something, off to the next project :wink:
  • buzzby365
  • Proficient
  • Proficient
  • buzzby365
  • Posts: 288

Post 3+ Months Ago

Rabid Dog wrote:
The way I understand your question is that you want to be able to page through your database and have the form automatically updated with the information on that record. Then you want to be able to make changes and save the changes.:


i want to be able to page thru forms that have already been filled out.

i want to be able to update the form and then submit the updated form as the same form rather than take up another row. each row will be identified by a special reference number.

i want to have a reference number on the form that is generated rather than inputted. it is to be sequential in ascending order. there are 2 prixes. there is an 'A' prefix and a 'X' prefix. so forms will begin with either 'A250' 'A251' and so on or they will be 'X302' 'X303' and so on, i have heard of using fopen(), fputs() and so on. i think that methods uses a text file where the number will be stored and updated everytime a form is fill out. on the submission the form will have a reference number.
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

I am sure RM and myself helped you with this issue earlier (the prefix one)

Don't use a text file, it will become difficult to manage when everything starts growing. Read my postings on DB Normalisation
  • buzzby365
  • Proficient
  • Proficient
  • buzzby365
  • Posts: 288

Post 3+ Months Ago

i wasnt really clear on the db normalisation. is that the best way to do it?
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

Yes DB normalisation is always the best way. The only time you don't normalise is when you specifically choose to de-normalise for very good reasons (which does not apply here).

Normalisation can be a pain but it's really simple once you get your head around the logic of it. RD posted this a week or so ago:
http://www.ozzu.com/programming-forum/database-normalisation-t26981.html&hi ... malisation


In terms of the problem on this thread, you are merely selecting one record at a time, and finding the record ID's above and below, as per RD's previous link. Load values into a form by echo()ing database values from a single record, as per previous examples with $_POST[] variables. You should also probably include a hidden field to indicate the current id of the record you are viewing.

Then you can edit those values and re-submit the form. Use the hidden form field (with the id in it) to select the correct record to update and you are sorted.

RD asked nem this question the other day, and I am wondering if it applies to you as well: how much have you formally planned this system before coding it?

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 62 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.