javascript - Multipart form with data output to browser in jQuery/PHP. How to show input data? -


i'm trying create form 3 steps:

  1. fill form
  2. check if data correct (show input)
  3. thank you

with advice of people here (regarding previous question) i've changed way of doing php + js-validation js + php process data.

i need advice how deal now.

previously i've had php if/else determined step show , kept data in $_session 2nd step , possible corrections in 1st step.

now i'm wondering if need 2 ajax calls (first process data in order show - 2nd form step uses $_session display data input in 1st step; second generate e-mail , pdf given data - same $_session step2).

maybe solution put data javascript 2nd step aswell , use $_session in final processing , generating.

what's common/your approach problem?

here's normal flow:

user loads page form on it. fills out. submits it.

you can validate every field fill out (instant feedback nice user's perspective) or validate using onsubmit event (in jquery $('#formid').submit). don't allow them submit if doesn't pass, return false submit function.

in case don't have js enabled (you can try prevent them using w/o js in reality can use curl -d "value1=foo&value2=foo2&value3=foo3" http://example.org/page/ around you) have validate data on server, too. js isn't enough.

if doesn't pass server validation, can redirect them form using location: http://example.org header or echo form again in server-side code. if pass, can use (insert db, echo it, email it, whatever).

you save data in database , add $_session. echo data entered along button "download pdf" or such.

they click "download pdf".

you have information need create , pdf. don't have validate need use $_session information create pdf. should test $_session make sure have valid input previous pages or else can mimic post page , generate pdf (perhaps blank though). avoid using data $_session state information -- i'll write db on post data (after scrubbing) if it's in $_session stuff tells me , stores other information configuration, etc. in case, i'd have written db in step 1 , use id $_session pull record , create pdf send it.

i think of validation can done in step 1 , separate step 2 delivery based on validity of step one.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -