Jump to content

How to Create a "action.php" page for HTML Form?


rashidpathiyil

Recommended Posts

How to create action page to fill #

action="#"

HTML Form code 1:

<form action="#" class="contactForm" method="post">
                            <input class="required" type="text" name="name" placeholder="Name">
                            <input class="required" type="email" name="email" placeholder="Email">
                            <textarea class="required" name="textArea" placeholder="Message"></textarea>
                            <input id="conSubmit" type="submit" name="submit" value="Submit">
                        </form>

HTML Form Code 2:

<form id="subscribeForm" action="#" method="post" class="subscribeForm pull-left">
                                <input id="subEmail" type="email" name="email" placeholder="Enter your e-mail">
                                <input id="subSubmit" type="submit" name="submit" value="Subscribe">
                                <div class="clearfix"></div>
                            </form>
Link to comment
Share on other sites

Remember to never retrieve data from  $_POST or $_GET as they are deprecated.

You're probably confusing $_POST with $HTTP_POST_VARS, which is deprecated. $_POST and $_GET themselves are not deprecated.

 

Grabbing data directly from $_POST or $_GET is fine in most cases, as long as you sanitize/escape before you use it elsewhere. You can't just fetch your data from a single filter_input at all times, because sanitation is a contextual thing. What makes sense for one system might not make sense for another. For example, SQL injection makes no difference when outputting to HTML, and XSS makes no difference when saving to a database.

Link to comment
Share on other sites

rashidpathiyil, your question, How to Create a "action.php" page for HTML Form?, isn't a programming problem. it's a research question based on a lack of knowledge. research questions are things you need to take care of yourself in order to learn enough about a subject so that you can make the attempt at performing a task. a programming problem, which is what programming help forums are for, are what you have after you have written some code and you have a problem or error with it that you cannot solve yourself (though too many people just dump their code on help forums without first making any attempt to learn and fix it themselves.)

 

the www was created for researching information. php was created primarily to process form submissions. there are several 100's of thousands of php form processing examples posted on the www that you can examine to learn the basics of How to Create a "action.php" page for HTML Form.

  • Like 1
Link to comment
Share on other sites

rashidpathiyil, your question, How to Create a "action.php" page for HTML Form?, isn't a programming problem. it's a research question based on a lack of knowledge. research questions are things you need to take care of yourself in order to learn enough about a subject so that you can make the attempt at performing a task. a programming problem, which is what programming help forums are for, are what you have after you have written some code and you have a problem or error with it that you cannot solve yourself (though too many people just dump their code on help forums without first making any attempt to learn and fix it themselves.)

 

the www was created for researching information. php was created primarily to process form submissions. there are several 100's of thousands of php form processing examples posted on the www that you can examine to learn the basics of How to Create a "action.php" page for HTML Form.

 

We know how to make it. But we are not going to do it for you. You need to go study some tutorials and learn the basics.

 

You're not ready to ask for help yet.

Ok guys,

:cry: 

Link to comment
Share on other sites

@scootstah, Excellent starting point.

 

 

@rashidpathiyil, Stop crying   :happy-04: and go through that tutorial as well as the one for HTML & CSS https://www.codecademy.com/tracks/web How to make a website https://www.codecademy.com/skills/make-a-website and when your down on all that,  the SQL tutorial https://www.codecademy.com/courses/learn-sql

 

After you understand all that, your likely to come back providing answers for people rather than asking for answers. Code on my brutha!

Link to comment
Share on other sites

You're probably confusing $_POST with $HTTP_POST_VARS, which is deprecated. $_POST and $_GET themselves are not deprecated.

 

Grabbing data directly from $_POST or $_GET is fine in most cases, as long as you sanitize/escape before you use it elsewhere. You can't just fetch your data from a single filter_input at all times, because sanitation is a contextual thing. What makes sense for one system might not make sense for another. For example, SQL injection makes no difference when outputting to HTML, and XSS makes no difference when saving to a database.

 

I was thinking of HTTP_POST_VARS ... Never answer questions on a heavy dose of meds is a good side note of this. 

 

I usually create helper classes to sanitize and validate my data depending on what I'm doing with it. I usually suggest to use the filter_input methods if a question is vague. This will at least get someone on a path of sanitizing and validating their data prior to doing anything with it. To many times I've seen people who take form data and save it right to a database because they followed some basic online tutorial that doesn't give any kind of security advice along side the basic how to.

 

Thank you all who pointed out my mistake, and I'll try to remember my meds alter the state of my mind and I shouldn't try to answer questions shortly after taking them again  :)

Edited by valandor
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.