The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Making a Form, Using PHP to store form data
nbrown2000
post May 28 2017, 01:00 PM
Post #1





Group: Members
Posts: 1
Joined: 28-May 17
Member No.: 26,419



I am completely new to HTML and PHP, and just coding in general and need some help with making a form that saves the inputted data in a simple .txt file in the same directory on my web server and emails me whenever the form is submitted.

I have the HTML form all setup and looking how I want on the web page, now I need to have the data saved in a formatted .txt file and have an email sent to me whenever the form is submitted, which I have no clue how to do so please bear with me. I need step by step help because like I said, I've never used PHP before and have no idea how to start. Sorry about that...

Anyways, here is the code snippet from the form, this is as far as I've gotten. I know as a basic I need to make the action of the form be a .php file but I don't know how to format the .php file or what to put in it.
CODE

<form method="post" action="script.php">                
   Your Username
   <input name="name1" type="text" maxlength="25" required/>
   Player Who Referred You
   <input name="name2" type="text" maxlength="25" required/>
   Choose a Reward
   <select name="reward">
      <option value="r1">value1</option>
      <option value="r2">value2</option>
      <option value="r3">value3</option>
      <option value="r4">value4</option>
   </select>            
   <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit Referral" />
</form>

How I'd like the .txt file to be formatted is to have "[name1] was referred by [name2] and chose [reward]" Is there any way to accomplish this, as well as making it so that the form can only be submitted once per user?

Again, I am completely new to this and need step by step instructions on how to accomplish this.

Thank you for your time.

This post has been edited by nbrown2000: May 28 2017, 01:01 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic
nbrown2000   Making a Form   May 28 2017, 01:00 PM
Christian J   I've never used PHP before and have no idea h...   May 28 2017, 03:49 PM


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 25th April 2024 - 12:06 AM