I have a form with fixed elements like radio button, text boxes, drop downs, etc.
There is also an area of dynamically generated dates and text boxes passes to the Post as an array to be saved into a MYSQL database.
The form is quite big and I would like to give the user the possibility to save it avoiding to have to retype data all the time.
I would also like to give the user the possibility to save their choices by storing a date and a description of their selection.
The problem is that I don't know how to tackle this problem as I don't know how to handle the dynamic part of the form. i am trying to generate a sort of automatic process but I cannot think of a workable solution.
Any idea?
If by dynamic you refer to xml requests ( ajax ) then you can easily save all the data in session cookies, as this very site does when you're asking a question. :P
Related
As I am writing my program by PHP programming language and Mysql DB in WordPress CMS, I built a plugin to create and handle a customize form in a special workflow to the needs of our customer.
After form being filled by the user, one of the editor users of the site would check the data of the filled form and validate them.
The screen shot of the validation page that is show to the editor users is like this.
As you see I fetch data of the form from Data Base and print them to the editor users to validate them. At first all the field are display in green background. By using jQuery I give the editor users the ability to click on the filled that has problem and change the color of the field to red. like the below screen shot.
My question is, how could I store the data about which fields are filled with wrong data (The field that are showing with red background) and use this kind of meta data to create an edit page for end user to correct that fields?
Of curse there are a lot of way to do that. The easiest but in my idea not optimize way is to add Boolean fields match to the form fields in Data Base and submitting hidden field according to that Boolean fields to store the information that each field is correct(TRUE) or not correct(FALSE).
The forms that I am working on have about 174 field that most of them are varchar(254). So the size of data that is storing in data base is huge and I don't wanna make it larger.
Ultimately could you please help me. Is there any other way to store the jQuery actions of the editor users and show that stored data to end users.
I am looking for your help.
Bests.
I'm working on a recipe input form. The current version of the form is very basic....takes the data entered and inserts it into a recipe table.
I want to change this form so that the ingredients are no longer a simple text entry....rather i want it to be selected from a list of ingredients.
Here's what I've done so far...
- created a "recipe" table which has all the recipe data
- created an "ingredients" table which will be the list of ingredients to select from
- created a "recipeingredients" table which will be the list of ingredients selected for the recipe. this is just a id table...recipe_id and ingredient_id.
Here's what I need some direction on...
- When the user is in the addrecipe page, they would start entering in some information. When they get to the add ingredients portion they will have to click some sort of link that will open a new page to select ingredients. When they click that link, I would like to save all the form data they have already entered so this data can be repopulated into the form when they are done selecting ingredients.
How should this data be stored for temporary use?
SESSION variables?
DB entry without commit?
POST the variables back and forth between pages?
Please let me know if I can provide more information to be clear...
Thanks!
I'd use SESSION variables. That's the cleanest way in my opinion. A DB entry without commit looks a bit like a dirty hack to me. By the way, writing to a file is much faster. Using POST and input type hidden form fields could also be acceptable but keep in mind that the data is included in the html source code in clear text. And for bigger data it can make your source code a mess. You'd better store them in a temporary file. So, if you're using sessions anyway and your data isn't too big go for SESSION variables. Moreover if the data is of any confidential nature using SESSION variables or protected files on the server is obligatory.
I have a form whereby a user fills it in and clicks submit. This then stores the information in the database. I have a field called height. And I want the user to type in something like 10, but I dont want them to type in the measurement aswel. I want this to be added to '10' before storing in the database
So when they click 10 and submit, i want it to show in the database as 10inches or 10".
I tried to google it but I get nothing because I have to be quite specific with keywords and I just dont know how to search it.
Does anybody know how I can achieve this?
Why do you want to store this in the database as text? That should not be a database concern, but instead be a UI concern. Store the 10, and just add the inches when you pull the data out?
Or you could store the 10 as a value alongside a mapping to what type it is (such as inches/cm/etc). This design will give you much more flexibility
You can use javascript to validate the textbox value on form submit (onSubmit)
In server php script, you could also check the value again.
Ok, I know there have been a few questions posted on this but a lot of the information are dotted around and not necessarily connected in one form that I need for my site.
Basically I want to create the style/functionality of the twitter form on their home page.
Where inside the input fields are the labels, and when you click on the input the fields the labels don NOT disappear but fade into a different colour. Its only when you type, is when it disappears.
If they don't type and press submit I want the verification signs come up ( I know how to do this but it seems to be conflicting when I put the jQuery code in)
When all fields are inputted I would like the form to fade and represent a thank you message whilst
the data gets placed into a mysql ( specifically a MAMP/PHP My Admin) database.
Very similar to this form on hbuddy.com
Would massively appreciate if this was responded in a step by step format, simply because i am at the beginning stages of learning pretty complex programming language.
Thanks!
you can try jquery ajax for form submission..
These links will help you for getting started..
http://net.tutsplus.com/tutorials/javascript-ajax/submit-a-form-without-page-refresh-using-jquery/
http://www.9lessons.info/2009/04/submit-form-jquery-and-ajax.html
http://www.ryancoughlin.com/2008/11/04/use-jquery-to-submit-form/
I'm looking to create a multi page ordering form the first page would contain some dropdown and text fields, the second page would contain more text fields, the third page would be an order summery with paypal payment option.
I'm just wondering what the best way to create this order form is. I've used sessions in the past but never with users entering in text and picking items from drop downs, does anyone have any resources for doing this? Or does anyone know of a jquery or other ajax example or plugin I might be able to use and modify.
any insight would be a big help.
thanks
The simplest technique might be to use hidden form fields to carry fields from previous screens through to the final screen.
Just make sure you validate all the values when the final screen is submitted to make sure that the user hasn't twiddled the data.
You don't need to do pagination at all if you don't won't to. Just use css to show/hide the "pages". It doesn't sound like you have to save the "state" at any point.
But if you want to do multiple pages, use a session or a cookie to track the user. Then save the data to a database a mark it as incomplete. On the final page, retrieve it all and show it on the page. The server can't tell if a request is ajax or not, so it doesn't matter what you use for submission.