Survey from - where to store info

I’m just starting the survey from project and have a question regarding what URL I would need to put down in the action attribute for the form. I looked up how to create a form and all sources specify that a url is needed. Here is an example one:

<form action="/action_page.php" method="get">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <input type="submit" value="Submit">

In a actual web app, you would need to send it to a url to process form data but this project is intended to only front-end technologies. So don’t worry about providing an url for your form.

1 Like

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

Note: Backticks are not single quotes.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.


1 Like

Thank you for your help.

THanks for the pointer.

Typically most forms use the “post” method instead of “get”.

The form you show above would submit the information to the action_page.php hosted on the same server and in the same directory as the html file the form is in. The php file would capture the form control elements’ values and could then send an email message to a specific email address.

Free Code Camp does not teach PHP, but if you continue on to the Back-end part of the curriculum, you will learn how to do something similar using node.js.

You can easily find websites showing you how to write a PHP script to process a form and send the results to an email address. The server you have the PHP file on must be configured to execute PHP code for it to work though…

1 Like

Thank you for the additional information, Now I know what to research.