I'm doing a project and i'm stuck, Hoping someone can help me with this part of my project please :)
In trying to create a simple classifieds section on my website, I had a form for various information which worked fine, then trying to add images to the database i fell into a problem as the listing wasn't created so the images wouldn't tie in.
So i decided to do a form with 4 steps...
Step 1, choose category, step 2, fill in description, step 3, add photo's, step 4, View listing and confirm it.
Please could someone help me as i'm stuck.
What i would like is...
Step one. Choose category
Step two. Fill in title and description
(Then on clicking to step three it will save the data from steps one and two to mysql database. This is where i'm stuck)
Step three. Add pictures
Step four. Review listing and confirm it. (Will activate in db)
The steps i downloaded from code canyon as i thought this would be an easier and user friendly way.. :)
I look forward to your replies and hope i've given enough information:)
Thank you!
You can do either using AJAX or php sessions.
Here is the AJAX way
function autosave() {
new Ajax.Request('autosave.php',
{
method: 'post',
parameters: {id: $('id').value, save_text: $('myInput').value},
});
}
Now call this function with some Interval.
Other way is you need to place you code in php session and you need to habdle it like - every action you need to save your session data, sameway you need to load if you do back and forward.
Provide more details about php version, some forms, fields and database, I will edit my answer
Since you're new to PHP I'll give you an idea of what to look for. If your page doesn't use AJAX then validate the post data at each submission. If the post data is valid then save it into the session (use the $_SESSION superglobal) and save it to the database at whichever step you need and wipe out the data you just placed in the session.
Alternatively you can use AJAX and just submit the form when the required steps are completed.
Since you didn't provide any code I won't either, but I figure a nudge in the right direction wouldn't hurt. Come back and post another question when you have some code if you get stuck.
Related
Here's the scenario:
I want to display a music playlist for each DJ at a radio station on my Wordpress site, but I don't want to have to enter that data in (Each song, artist, album, etc), in a specific custom post type or something like that.
I want each DJ to have access to a form where they can enter the playlist data in, and I can use that data. I was thinking of making a little webpage form that they can access, and then I query the database to get all that stuff, but I imagine that maybe there is an easier way using Wordpress.
The thing is, I don't want to give each DJ admin access to make posts with those custom fields filled in, so I'm not sure if there's a way to do that.
Maybe a page on the website that is password protected to fill out the form, and then I can use that data in a different page on the site? (Password protected so I'm only receiving data from actual DJs, not random people or bots.)
Sorry if this is an ignorant question, or if I'm unclear.
I searched a little bit, and couldn't find much.
Thanks in advance for ideas and insight!
You need to decide your method for doing this and try it out, when you run into a problem then you post here. It sounds like you know what you need. You're looking for a password protected form (which will check against a database) and pages based on a query to the database. This can be done in PHP or you might be able to find a Wordpress plugin to help you out.
Maybe start by making the PHP form. Then you could add the password protection. After you have that working you could make the PHP page that would query the information submitted. Take it one step at a time. It'll be much easier for people to help you if you're troubleshooting a specific issue rather than trying to figure out the logistics of how the whole system will work.
I am using a form on a SilverStripe page, the form is currently quite long. I am looking for a way where I can paginate the form. I would like to have 5 fields showing. Once them fields are filled out the user could then click next and be shown the next 5 fields. Also a previous button would be required. Thanks for your help if you need any more info let me know.
You probably want to look into the multi-step-form module : "MultiForm is a SilverStripe module, allowing flow control for forms, and step process to be automatically determined based on configuration variables on each step class. It augments the existing Form class in SilverStripe."
I believe this allows you to do what you need. The github repository has a complete example to set up and I recommend reading it in detail.
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.
im trying to make a simple page with search engine. i read, that if i want to implement autocomplete/autosuggest with form, i have to use ajax. thats ok for me. there are a lot solutions on the intenret, but unfortunetly all of them is the same script :/ and thats fine for me :) but i want to go further. i want to show autosuggest results in table for example below search form. the data is stored in a simple array (eventualy, source mysql) i know that kind of script isnt easy to write, so i ask you to give me a hint or something. trivial solution is use php, but this needs submit button.
help, im stuck :)
You have to follow steps given below
1] Apply onkeyup on the textfield and called ajax request
2] findings = select * from artists where name like "params[]%"
where, params[] is the content of the textfield
findings is ur variable which should pass to the view as response.
3] Called a partial (view) in which you create a table depending on the response and replace a div on each ajax request.
Hope this isn't a waste of your time. I'm working on a project, and it occured to me that there's a chunk of code out there, that should allow me to see how others have implemented this.
I've got a project where I'm going to have a page, with a sel box. the user will select an item from the selList, and based on the item selected, a separate section of the page (areaB) will change in terms of the content/tbls being displayed.
i then want to allow the user to go through a series of subpages in areaB, where the user goes through a submit/cancel/confirm process, where the stuff in areaB changes, with the rest of the page remaining the same...
i'm trying to figure out the best approach to implement the on both client/server side.
i could just have an ugly "if block" where i have abunch of logic, and i completely regen the page each time the user selects an action..
i could have an approach that might involve divs/frames, where i then just regen the targeted frame/div area.. is this even possible??
i could have some form of ajaxy process, which would only alter the targeted section(s) of the page...
so.. i'm trying to talk to anyone who has ideas on how to do this, or more ideally, if you know of a good code (client/server) side example of this... that i can examine. i'd really appreciate it!!
i've got a more detailed overview but didn't know if it would be cool to post it here...
thanks..
tom
If i've understood good this can be done in axaj. This is my idea you will have a where you load the current page with a form. After the submit button is pushed the values from form will be subtmited to an procesor let call it formprocesor.php. In formprocesor.php you will have a case that will check the step where you are in your submited for and will return the corect values to ajax proccessor in the main page. After values are recived, the ajax proccessor will display them in the result
Here is a little example: http://24ways.org/2005/easy-ajax-with-prototype there are more on a search on google with "ajax prototype tutorial"
Good luck!