PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 1st, 2012, 10:43 AM
BenWalters BenWalters is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2010
Posts: 10 BenWalters User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 30 sec
Reputation Power: 0
Form Submittion

Hi All,

I have a form that people can fill in but I wish, once they press submit, for them to be taken to a page that displays the fields and the data they placed against it.
Then a submit button that posts to my DB (already have) and an edit button where they can go back and modify what is incorrect before submitting again.

Reply With Quote
  #2  
Old November 1st, 2012, 10:58 AM
gw1500se gw1500se is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,885 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 2 Weeks 3 Days 8 h 17 m 9 sec
Reputation Power: 581
Welcome to the forum. Please see ManiacDan's New User Guide to learn how to post a question that will produce useful help.
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.

Reply With Quote
  #3  
Old November 1st, 2012, 11:07 AM
BenWalters BenWalters is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2010
Posts: 10 BenWalters User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 30 sec
Reputation Power: 0
Hi,
What more information would you like me to provide?
I was under the impression that I have supplied enough information to produce a useful answer?

Reply With Quote
  #4  
Old November 1st, 2012, 11:37 AM
badger_fruit's Avatar
badger_fruit badger_fruit is offline
Confused badger
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2009
Location: West Yorkshire
Posts: 760 badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 5 h 15 m 18 sec
Reputation Power: 339
I think what gw1500se is trying to ask is "What is the actual problem" or "where are you stuck"? You've simply provided a "I wish for..." which is great and we're all behind you in achieveing that but other then that, you don't say what the problem is preventing this wish coming true or what you've tried so far (if anything).
__________________
The number for UK Emergencies is changing, the new number is 0118 999 881 999 119 7253

"For if leisure and security were enjoyed by all alike, the great mass of human beings who are normally stupefied by poverty would become literate and would learn to think for themselves; and when once they had done this, they would sooner or later realise that the privileged minority had no function and they would sweep it away"
- George Orwell, 1984

Last edited by badger_fruit : November 1st, 2012 at 11:42 AM.

Reply With Quote
  #5  
Old November 1st, 2012, 11:44 AM
gw1500se gw1500se is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,885 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 2 Weeks 3 Days 8 h 17 m 9 sec
Reputation Power: 581
And if you had read the link, you would have understood why what you presented is not enough.

Reply With Quote
  #6  
Old November 1st, 2012, 11:45 AM
BenWalters BenWalters is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2010
Posts: 10 BenWalters User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 30 sec
Reputation Power: 0
Oh ok, well the problem is I do not really have any idea where to start.

I have my table set up in MySQL DB, I have the form working fine. When I click submit currently it places the info into the DB and tells me that it has been submitted.

However I want to add the middle man, but showing the user what they have entered before submitting this information to the DB

Reply With Quote
  #7  
Old November 1st, 2012, 12:13 PM
badger_fruit's Avatar
badger_fruit badger_fruit is offline
Confused badger
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2009
Location: West Yorkshire
Posts: 760 badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 5 h 15 m 18 sec
Reputation Power: 339
May I suggest that if you have the 'write to DB' bit working then you keep it like that but on the confirmation screen, simply re-create the form and set the "values" of the HTML elements to the values submitted by the user.

For example, in this confirmation screen below, the user submits their name using HTTP POST ... I'll skip the write to DB bit but what we need to do sanitise their input using HTMLENTITIES and then write that back to screen ...

PHP Code:
if(isset($_POST['name'])) { $name htmlentities($_POST['name'], ENT_QUOTES'UTF-8'); }
echo 
"<input type='text' name='name' value='{$name}'><br />"


That's just a rough idea but hopefully will set you off in the right direction

Reply With Quote
  #8  
Old November 1st, 2012, 12:17 PM
BenWalters BenWalters is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2010
Posts: 10 BenWalters User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 30 sec
Reputation Power: 0
Quote:
Originally Posted by badger_fruit
May I suggest that if you have the 'write to DB' bit working then you keep it like that but on the confirmation screen, simply re-create the form and set the "values" of the HTML elements to the values submitted by the user.

For example, in this confirmation screen below, the user submits their name using HTTP POST ... I'll skip the write to DB bit but what we need to do sanitise their input using HTMLENTITIES and then write that back to screen ...

PHP Code:
if(isset($_POST['name'])) { $name htmlentities($_POST['name'], ENT_QUOTES'UTF-8'); }
echo 
"<input type='text' name='name' value='{$name}'><br />"


That's just a rough idea but hopefully will set you off in the right direction
I hadn't thought about doing it this way really, I don't really want duplicates in the DB and also on submit it produces an email which I would not want them getting many emails for the same form

Reply With Quote
  #9  
Old November 1st, 2012, 12:33 PM
badger_fruit's Avatar
badger_fruit badger_fruit is offline
Confused badger
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2009
Location: West Yorkshire
Posts: 760 badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level)badger_fruit User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 5 h 15 m 18 sec
Reputation Power: 339
Well, it was just a suggestion, you can of course, use that code above BEFORE it updates the DB and only have it update on their next click of the 'submit' button.

Oh, by the way, this method I suggested wouldn't end up with duplicates, at the point of displaying the form it's INSERTed the record and you can get the unique ID that is returned from the INSERT statement and use that in a hidden field.

It's up to you of course, as long as you make it clear to the user that "AT THIS POINT, YOUR DATA HAS NOT BEEN SAVED" then do it however you like but don't ever forget how dim users can be - even with a 72pt bold, flashing, red on yellow banner, it'll be ignored by them and they'll be left wondering why, when they closed the browser at that point, they have to re-do the entire form.


EDIT > With regards to the 'Thanks for submitting your data' email, only do that AFTER the data has been written to the DB, if the user then EDITS their submission, you don't need to re-send it (as you'll know if you're doing an INSERT or an UPDATE)

Last edited by badger_fruit : November 1st, 2012 at 12:36 PM.

Reply With Quote
  #10  
Old November 1st, 2012, 12:53 PM
gw1500se gw1500se is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,885 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 2 Weeks 3 Days 8 h 17 m 9 sec
Reputation Power: 581
Alternatively you can define a column or combination of columns as unique and update the database on the first submit. There would need to be some way to connect that column with the user (perhaps a username) to prevent inserting a duplicate record. Then after editing, do an update rather than an insert using that value in your where clause.

One final method is to manage all the editing on the client via javascript and then the submit would only need to be done once.

Reply With Quote
  #11  
Old November 1st, 2012, 02:33 PM
BenWalters BenWalters is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2010
Posts: 10 BenWalters User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 27 m 30 sec
Reputation Power: 0
Quote:
Originally Posted by badger_fruit
Well, it was just a suggestion, you can of course, use that code above BEFORE it updates the DB and only have it update on their next click of the 'submit' button.

Oh, by the way, this method I suggested wouldn't end up with duplicates, at the point of displaying the form it's INSERTed the record and you can get the unique ID that is returned from the INSERT statement and use that in a hidden field.

It's up to you of course, as long as you make it clear to the user that "AT THIS POINT, YOUR DATA HAS NOT BEEN SAVED" then do it however you like but don't ever forget how dim users can be - even with a 72pt bold, flashing, red on yellow banner, it'll be ignored by them and they'll be left wondering why, when they closed the browser at that point, they have to re-do the entire form.


EDIT > With regards to the 'Thanks for submitting your data' email, only do that AFTER the data has been written to the DB, if the user then EDITS their submission, you don't need to re-send it (as you'll know if you're doing an INSERT or an UPDATE)
This sounds like a wonderful solution then I will attempt to put this into action tomorrow and let you know how it goes Thanks!!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Form Submittion

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap