Insight to PHP?
-
I need some direction on this.
I'm looking into creating a document a user can fill out, let's say, on my website(similar to an employment application), and then when they slap the submit button, relevant fields of my choosing from that document would be converted to a plain list and emailed to a specific person.
I was thinking PHP could do this, and I wanted to learn PHP anyway, so I started doing the free lessons on codecademy. But I'm starting to think this isn't possible with PHP unless I made the form with PHP, and then extracted the data from there...?
Can anyone advise?
-
Well the form would be displayed by HTML5, PHP itself has no display language. But it would only make sense to make everything in PHP, what other option did you have in mind?
-
@scottalanmiller Of course, lol. My question is more about the "behind the scenes" stuff.
I didn't know if I needed PHP in conjunction with some other language, or if it's even simple stuff in the world of php.
-
I had initially started researching how to do this with a fillable PDF, but people have said it's impossible. So I guess I'm moving on now to research if and how hard it would be to do it with php.
-
@G-I-Jones As Scott mentioned, HTML would render the form for your users and you would use PHP to process that form to send the email. PHP won't send the actual email, you'll need a mail server to do this, but PHP will take care of getting the information from the HTML form and adding the necessary bits and data processing to forward off your email.
One caution though...are you sending personal, private information via email? If you are, you may want to rethink your approach or at least take steps to ensure that your browser connection to the web server is secure (Let's Encrypt can help here) and that you are sending the email from a TLS enabled email server to a TLS enabled email server otherwise your data is open to interception while in transit.
Definitely more than one way to skin this cat, depending on your full requirements.
-
@NashBrydges That answered my question in full. I appreciate that.
-
@G-I-Jones said in Insight to PHP?:
@scottalanmiller Of course, lol. My question is more about the "behind the scenes" stuff.
I didn't know if I needed PHP in conjunction with some other language, or if it's even simple stuff in the world of php.
HTML5 is the only language that exists on the browser. PHP can't run there. HTML5 is the display language of the web. If you don't want to use the web, you can use only PHP of course.
-
@G-I-Jones said in Insight to PHP?:
I had initially started researching how to do this with a fillable PDF, but people have said it's impossible. So I guess I'm moving on now to research if and how hard it would be to do it with php.
Not impossible, just ridiculously hard.
-
Don't reinvent the wheel. Install CMS of your choice and be done with it, Drupal, Joomla, Wordpress for example. I'm most familiar with Drupal, and with Webform module you can create any form with any field types you want. Or even use Google Forms and embed it in existing website.
-
PHP webforms are like ultra easy and there are tons of examples out there.
-
This is super easy to do. Get a PHP mailer script. Create a form on your web site using HTML then have the form submit <form method="post" action="?"> I put action ? because it came back to my same page... however you can put it to another PHP file called something like mailsubmission.php... in that PHP file you need to get the variables from the form you submitted. Then you need to receive the form items into / from a Post Variable like this
$to = $_POST['to'];
$oldmessage = $_POST['message'];
$email = $_POST['email'];
$name = $_POST['name'];$sent = $_POST['sent'];
Then use a PHP mailer script to then take those and mail them to the person you want to receive them. Plenty of tutorials on stack exchange how to further do that.
You can also harden the form itself making sure the expressions are legit with javascript if you want to verify things and make sure no one is hacking your form. Hope this helps.
-
Let me know if you need any help doing so glad to assist if you hit a road block...
-
Whatever you do, please make sure that you validate your input in PHP before you send the information along. Otherwise, spammers will abuse your form heavily.
-
If you don't feel like doing a lot of work, Google forms might fit the bill. It keeps track of responses, etc also.
-
If you are using a CMS, it is really easy to accomplish this via plugin, but it isn't necessary to have a CMS as it is really easy to do with php mailer.
http://www.kvcodes.com/2014/01/how-to-create-contact-form-with-phpmailer-to-send-mails/
-
If you just need to create a form and get output, share etc. please check https://www.typeform.com/
Some examples https://www.typeform.com/examples/
-
@IRJ said in Insight to PHP?:
If you are using a CMS, it is really easy to accomplish this via plugin, but it isn't necessary to have a CMS as it is really easy to do with php mailer.
http://www.kvcodes.com/2014/01/how-to-create-contact-form-with-phpmailer-to-send-mails/
Ya Drupal also makes it really easy with content types.
-
One cat, so many ways to skin it. Definitely no need to re-invent the wheel on this one.
-
As a tool for learning PHP, this should work well. No database needed, just a simple mailer. A single PHP "page" app. Great place to start.
-
I agree, if you pay attention to the bit about wanting to learn PHP, it's something easy to set up and easy to maintain.