open new TCPDF after form post - php

I have a form, test.html, (create in JS using dhtmlx, unimportant) that I want to submit to a PHP script, generateReport.php
generateReport.php creates a PDF using the information posted from the test.html using the TCPDF libraries.
How can I post the variables from test.html, and have the page redirect to the filled in PDF? I would prefer not to store it, but that really is not a problem if I store it temporarily.

Try to post the form to generateReport.php by using form action.
And Just get all you form values by using $_POST['form_field_name']
I think this will help you to get all form values.

Related

dealing with forms in php

I have only one php file called index.php. I have created there a form with one input text element and one input submit element. When I click on submit I want to deal with the value from the input element in the function that is in the same file, namely index.php. So my question is what to write into action attribute of the form element, if i will write index.php it doesnt work properly because then I get to the dashboard of wordpress. (I am trying to create a wp plugin).
-I am PHP and also Wordpress beginner-
I think the quickest way is just not to set any action on the form html tag. That way it will just POST/GET data to the same page from where you're calling it. Does this make it for you?

Save entire form to file in php

I have a standard web page enclosed within a PHP form. Is there a way to save the entire contents of the form (HTML included) out as a it's own HTML file with the form answers included? The answers are either a drop-down selector or a standard text entry box.
I'd rather not have to generate a new HTML file with the responses if I can.
You can try to use javascript to capture the current html and responses of the form on submit, assign this code to a hidden form field and then submit the form. Having said that, I don't think this is a very reliable solution and also it really should'nt be so difficult to generate the same form with responses in php.

Simple Ajax Update Form with $_POST and $_GET

So I'm trying to understand jQuery's .ajax function so that when I create my sites CMS I can update content on the backend asynchronously. I'm creating a simple form to start out. I pass the id of the database using php in the action href of the form. I pull the data from the form and convert it to json using the .serialize() jQuery function and then pass the action and the data into the .ajax function. On my the backend I use php to pull the $_POST and $_GET items and update the database accordingly. Everything works except that the site actually links to my backend php site... I just figure this out actually but I can post the answer for future references for people. Let me know if my answer is incorrect.
It looks like I was using type="submit" for the update input for the form. Because I was using action = "mybackendhref" in the form This caused it to link to the actually page that I wanted to use .ajax to push the data to instead. Changing to input type="button" caused everything to work smoothly.
*By "mybackendhref" I mean the actual site I want to push the data to using .ajax.

Codeigniter submit form written in plain HTML

I'm playing for about 2 days now and can't make this out. I'm working in codeigniter 2.1.0. and I want to submit a form that is written in HTML. I don't want to use the CI form helper.
The reason is because I'm dynamically with JavaScript adding things in the form. When a user clicks an item then it's added to the form. Now when the user clicks the submit button all the items I added should be sent in a POST request, but my POST is totally empty.
Now I noticed that the POST only gets sent when I use form_input() from the CI form_helper.
Is it possible to just submit a normal plain HTML form without using the form helper?
Is it possible to just submit a normal plain HTML form without using the form helper?
Yes. The actual submit is totally independent to CI, just ensure you use the correct action URI of the form so that the correct controller action is called by the form submit post (I assume your form method is post) request.
You do not need to use the CI form_helper for the submit button. If you mock a form with these you will see that those just generate plain HTML and do nothing magically.

Display form values in a to pdf document

i created a system using php..
on my system..there is a form...in that form has a submit button and view in pdf button ..
so my question is how to transform my php form into pdf form..user can view the form in pdf format even he did not submit the form yet and the details that he enter is appear in the pdf format form..please help me..
You'll need to create the form in Acrobat Pro, PDFpen Pro, FoxIt Reader (with appropriate add-ons), etc. In doing that, you can include a form control button that submits the form values to a URL as POST. Write a PHP script to receive that POST similar to an HTML form POST, and you're good to go.
From there, you just post the PDF to your site and let the visitor's PDF tools do the rest.
Note that form validation is also handled in-PDF. The tool you use to create the form will include a bunch of ready-to-go validations you can use (e.g., phone number or social security number), and if something's missing, you can incorporate JavaScript. Note that the JS runs in the PDF reader, not the browser, so it'll work even if the user has JS turned off.

Categories