I am trying to make an html form submit data for processing to a php form. This works fine but when the data is validated and there are errors, somehow the data is cleared from the fields. I will like to know if there is a way to maintain the contents of the form controls even if I call the form on the php page that does the validation. I am a student and am new to php so please forgive me if I sound childish. Any elaborate explanation is welcomed. Thanks in advance
if the validations are static use javascript to do so.
but if you are doing things with PHP (getting data from DB and such) I recommend that you pass all the field info thru a get or post to be "RE-FILLED"
Related
I have created a form on AWS Wordpress using NinjaForms and want to save this data to a JSON file. The form is working properly. Is there any plugin that could help me with this?
If you could redirect me to any tutorial about this stuff would be fine too. Honestly, I am very new to wordpress and I apologize if this is a very basic question.
Any inputs are appreciated. Thank you!
For anyone looking for an answer
You need to use a hook from ninja forms first
Then go to function.php of your theme and access $form_data at the hook function and extract and save the data yourself.
This is pretty much how anyone would go about to send a POST request to an API from your form
Im really new to node/MEAN stack and i would appreciate if somebody can help or guide me or point me to some related tutorials.
I have just purchased a wordpress template for a booking application. This came with different pages for choosing a date, selecting a room, the booking information and confirmation.
I have put the html pages inside the public directory and it was already running.
From the index, clicking booking will lead me to choose-date.html, then to booking info without touching the server side. How do I get the value from the date in the choose-date.html and booking-info.html? I planned to submit the information on the confirmation page.
In asp.net mvc, this could be done by having a controller and action for each and save a session in the server. If i use asp.net mvc, i have to modify the html to use a layout and such. This i want to avoid.
Angular is for single page only and as i understood it could not be applicable to this scenario though im planning to used it to post on the confirmation page.
Any suggestions? I very much appreciate any help and guidance.
Here my folder structure:
You have essentially three choices as I see it. 1) write a new app using the Wordpress template as inspiration. 2) write a Wordpress app using the template you provided. 3) write an Express app and use the template you bought for just the html.
If you do the third, there are a lot of options for doing a multi step process, but the basic pattern I've found useful is to just have one object in the database (eg your booking) and have each form be either a PUT request (so you send the whole object over the wire on each form submit) or a PATCH (where you only send the new info).
FWIW you could still do the ASP.NET method you described with storing things in session, I just don't think that's a great way to go regardless of framework.
edit
I guess arguably you could also use angularjs and treat each html chunk as an angular template that gets fetched as a directive demands it. But I think that'd be tricky to get right given where you're at with the project.
recently i have been trying to so make a contact form work and i finally did after hours of struggle.
http://trulyamped.com/democon/contact2.php
This contact form works perfectly and the email gets sent to my account.
The only thing i wanted to know was how do i make the contact form work in an .html file. I do not want it to be in a .php file. I already tried to save the file as an .html file but it did not work. Please let me know.
so pretty much i want it to be contact2.html and still be able to work.
First of all, why does it matter?
But assuming for a moment that it does matter, you probably have a couple of options. They depend on where your code resides and what it currently does. If the page has PHP code that needs to execute server-side then it needs to be processed by the PHP interpreter server-side. To do that with an HTML file you'd need to configure the server to treat .html files just like .php files for server-side processing. This isn't ideal, though. HTML by itself doesn't need to be run through the PHP interpreter. So it's best to keep the PHP and HTML files separate.
Another option could simply be to separate the client-side HTML form and the server-side PHP code into two separate files. Something like contact.html and contactProcessor.php. In the HTML file you'd just post to the PHP file in the form. Something like this:
<form action="contactProcessor.php" method="post">
This would cause the form to post the data to the PHP file. Then the PHP file can process the data, do whatever you're currently doing server-side, and redirect the user to another HTML file as a response. So at no point would the user be "viewing" a PHP file. There's just be one used to handle the form post.
Again, I can't imagine why it matters though.
You would need to create a 2nd page that only has the email processing logic, let's call that email.php you could then update your form to post to email.php and change this page to be contact2.html as long as it posts to a .php file it will work.
<form id="contact-us" action="email.php" method="post">
Your bet is to use AJAX for the main form but will still need a server side script page to handle the mail sending. As far as I know, it's not possible to send mails from the client side.
So
Have the PHP page that actually sends the mail in a separate script file
Create your form in HTML and use AJAX to call the mail sending script from within your HTML page.
This way you can have your page in html and do the mail sending at the background.
Regarding saving your page with .html extension, of course it wouldn't work. Because your page contains PHP which is server-side and needs a web server to run, while html can be run on any simple browser on any device.
From the google site, I cam across a code that lets me display the recaptcha box. Although I must admit I have only started html today and hence, have no basics at all. The site does not have a verify code in html although it does in jsp and I dont know how to link it all since data from the html went to the servlet.
https://developers.google.com/recaptcha/docs/verify
specifis a list of parameters to be 'posted'
I am using Tomcat 7 and no Spring.
My doubts:
Can I have multiple forms in an html file
How do i send parameters from the precious form to the second form?
How do I link a jsp file that will verify it to be run through the java class invoked by the html file
How do I get the user (accessing my app through a local server) remote IP address?
Got sorted out. Since I did not understand the problem in that, I proceeded to simple captcha itself. I must admit I feel like a fool saying I din't know html/jsp. The second day it was all so clear. I must have been positively psyched. Unwilling to see the not working code again, I started fresh.
Answers :
I can have multiple forms in a html
as set and get parameter as a session and request functions respectively.
through a form itself or response.sendredirect("")
Remote address class and methods.
I'm very new to ColdFusion (this is my second day dealing with it) and I am implementing a simple HTML page. I have a feedback form on this page and when the user hits submit, I want to email the contents of the form to myself. I have to do it using cfmail.
To try it out before I implemented it, I created the following cfmail.cfm file:
<cfmail from="#form.from#" to="myemailaddress" type="html">
Some text
</cfmail>
and passed the name of the file to the action attribute of my form. Every time I click submit on my form, it just opens the above file.
All the examples I find online pretty much show the same thing, but obviously I'm way off here.
Am I using cfmail in the wrong manner?
Thanks in advance for your help!
Just like Evik said in the comments, add a subject because it is a required field for the cfmail tag.
<cfmail to="#form.mailto#" from="#form.mailFrom#" subject="#form.subject#">
#form.body#
</cfmail>
Also check the mail settings in the ColdFusion administrator under Setting > Mail. There is also a mail log in the administrator you can check.
I recommend using Adobe online docs for ColdFusion. I referrer to it almost daily, they are great.
Here is a link to the cfmail for CF8 but at the bottom it links to other version.
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_m-o_01.html
If it's just opening the file and not throwing a ColdFusion error (which it should do without the subject) then you most likely have a problem in your ColdFusion installation or more likely in the setup of your development web server is not handling the cfm scripts (IIS or Apache depending on the platform).