4
Apr

Php and MySQL

I want to create a form to send employee data. One of the option I use button type.

After the user complete the form, it will be sent to confirmation page, the if confirmed it will be sent to savedata.php…But the data only arrive to th econfirmation page, it cannot be brought forward to th enext page.

Is there any other way than hidden type input to make sure the form completed still contain the data until posted to savedata.php?


Answer:
If you're just confirming the form was filled out then you are doing it strangely. That should be done with javascript on the originating page by checking the form data then submitting with javascript.

You shouldn't really need 2 pages after the entry page to check and submit the form data. You're making it harder than it needs to be.

With more details on what you are doing i may be able to provide better help

well i know you have a form, but are you simply verifying that it was filled out, or are you trying to validate it against a database?

here's a decent tutorial on form validation with javascript http://home.cogeco.ca/~ve3ll/jstutorb.ht…

this would be used to make sure all fields are filled, and things such as email and dates are in the proper format

Ok I see what you are doing now. You were going about it the right way. What you want to do is first get the data displayed on the verification page using php….I assume you have that step done.

Now what you want to do is recreate the form using hidden variables in that same page….would look something like this.

">

…..

that will get the form info onto your second page for you to use by recreating the form. Using Javascript you can edit the action of the form. If they hit the "change" button set the action back to the originating page, and use PHP in that page to fill out what form data is there. If they choose continue, then good. That just submits the form to your final page for processing.

there's other ways to do it, but that will be the most straightforward. It sounds complicated but hopefully I have made it somewhat clear.


Answer:
Sorry to say this but One of the things I see is that your form is badly constructed. Your input buttons should not be within the label tags. A proper form construct should look like this:

yours looks like this:

All a label really does is provide an extra clickable area to put a cursors focus into an input area. you can just use plain text to describe them.

A text input area also needs dimensions :

otherwise a user may not have room to enter their data.

I don't know enough about php data handling to help there

but You may want to use the resources of either www.w3schools.com or xhtml.com to get a better handle on the development side of your creations before trying to generate php/mysql output.

you can get a free javascript, php, or CGI Form handler from hotscripts.com and adapt it to your pages. With a little work you can also avoid scripting altogether by having the output sent to you as an email..

Hope this helps..

Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList

This entry was posted on Friday, April 4th, 2008 at 5:47 am and is filed under Programming. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or TrackBack URI from your own site.

Leave a reply

Name (*)
Mail (*)
URI
Comment