Thumb selection and form field submitted as GET or POST - php

I want the user to select a thumbnail (which the browser will list from a specific folder) and write comments in a text box and then submitted.
Any ideas which way I should go for? Initially I thought to put thumb selection in PHP Variable but that seems not possible.

Related

Best way to store data about problems in fields of filled form

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.

How to write over image on specific position with HTML or PHP?

I am making a form in php and allow visitor to register for our site. Now after filling the form, I want to show his entries over a image at specific position.
for example::
in this image:
Contact form
after inserting all the info in my site's contact form, I want to show details in above image; like name, email, comment.
So my question is, how can write text over image at specified position?
You can use position:absolute on the container and
make your form position:relative. Use Top, Right, Left, Bottom values to adjust it where ever you want.
Add the background:url(imagepath); to your form or inner div.

Is it possible ot send the $_FILES array to PHP using jQuery/AJAX?

I have a form our guests use to submit a post to a very simple 'message board'.
Now we want to allow the users to upload 1-10 files, but the concern or requirement is to do this outside of the MAIN form submit.
MAIN FORM consists of:
input field 1
input field 2
text area 1
Submit button
I currently have it so there is an initial browse button.. ( below the text are and to the left of the main submit button) and once a file is picked.. and display a link for the user to add another 'browse' field..
What I would like to do is have an UPLOAD button below all these dynamically created browse/file upload fields... that will send all the file data to an external .php script to upload the files in question, and then just return the file path/name back to the main form (maybe in hidden fields? I dont care).. so that these file path/name string values are submitted when the MAIN FORM is submitted..
hope that make sense.
Is this possible? And if so how do I go about this? The concern is to handle the asset uploading/file handling outside of the main form submission so the users details are not lost if something goes wrong with the file upload portion of things.
You can do this with JQuery and Ajax. There are various plugins are available for this. You can try this - http://plugins.jquery.com/uploadfile/

Read write categories from form

I have low hopes of somebody actually answering that cause of the high level of spoon feeding involved ;-) But then again, I ll give it a shot.
I would like to make a simple form consisting of an input text field, a dropdown list of existing categories and a submit button. The logic would be:
Case 1: User inputs text to the input field and clicks submit. Then code checks if text equals name of existing category. If category name exists then nothing is done and code prompts user that this category exists. If category name does not exist then the entered text is being written in the database as a new category.
Case 2: User leaves input field empty and selects a category from dropdown list of existing categories. Then upon clicking submit, the code would store the category name selected from the dropdown in a variable.
Case 3: User clicks submit without entering any text or selecting any category from dropdown, then code does nothing and prompts for user to retry..
Any help, code or link, would be much appreciated.
Harry
What you are talking about is a relatively easy task. Even when you are new to programming, this should be possible. What you want is a form validation.
I would recommend to call a function on submit like that:
onsubmit='checkForm()'
Put this code in your form tag.
In that function you can check what ever you want to make sure that the form works the way you want it.
You should read this:
http://www.w3schools.com/js/js_form_validation.asp

Ajax jQuery picture upload - newbie question whats the best way to handle this?

I have a page with a form on it that the user visits to fill in some info before he signs up for a profile. Underneath the form is a preview of what the profile will look like. I have some javascript so that as the user types into the boxes in the form, the corresponding bit of their profile fills with whatever they're typing. IE they type into the 'title' form input and it will appear in the id="title" div below.
In that form I also have a field so the user can upload a photograph. When the user chooses the pic he wants to upload and closes the dialog, I'd like a resized (so that it fits my max height/width requirements) image to also appear in the preview bit below the form. All this would happen before the profile form had been submitted.
Whats the best way to go about this? I've done a fair bit of googling and while there's plenty of plugings they all seem to either do something far too complicated or miss something out. Can anyone please tell me the best way to handle this?
Thanks :)
If it makes any difference I'm using cakephp.
Side question - is there a way to make sure that when the choose file dialog opens, there is only the option to select image file types. IE all the .doc .xlt etc aren't there?
As to your first question, you'll have to upload the file. So you'd upload the image and store it in a temporary location that you can still stream back in an IMG element. When the user saves the form, you can then discard the temp image. You'll probably also need some sort of cron/scheduled task that cleans them up if folks never save the information and just leave.
As to your second question, nope. You can check it on the client after they have selected a file, but then I strongly recommend checking it again on the server.

Categories