Reputation: 382
I need some general help on what tools to use. I was a programmer so I know how programming works, but I'm wildly out of touch.
So I have a website. On it, I've added input form fields (name, address, etc.) I'll put the code below.
I need to know what language/tool to use to get those inputs sent to a file that will be easy to check, or better yet, sent to an email address. Someone other than me will be keeping that member info. So I need them to easily have access to it.
I've looked briefly at PHP and JavaScript, but before I spend weeks reading... can you tell me what tool, and a basic idea of how to do it, and great would be a reference to a w3schools page that covers this topic.
So far for gathering data off the site I'm using:
<form ACTION="play_form.php" method="post"
target="_top" accept-charset="UTF-8" enctype="application/x-www-form-
urlencoded" autocomplete="on" novalidate>
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
Areas of interest: <input type="text" name="areas"><br>
<input type="submit" value="Submit">
</form>
I want to use post, not get. I'll turn on validation after I figure the basics out. I have no idea what type of file to put into action field.
Nor what to put into that file I create. (Such as what w3 reference to use to figure it out).
So far I tried out the http://www.w3schools.com/php/php_syntax.asp sample and it works on Firefox, but when I copy the code to my own website file (currently on my own computer), it doesn't work. It displays the straight text "My first PHP page" but not the "welcome world" input text. It did the same in IE.
Thanks for any guidance!
This is a low money non-profit. We don't have servers. I just need people to be able to pay membership with paypal and at the same time add various info about themselves that we can then gather and store in our offline private database. There is no ongoing need for them to access that data again.
I should have included this originally.
Edit for suggested answer:
That answer had some relevant info and helped solve why my php wasn't printing the passed through input form data. It needed a name="something" given to the submit line.
It didn't answer to the rest of the problem, that I can see so far.
At this point I've figured out a bunch. I probably could get the input forms into an SQL database with some more work. That helps me know how all of this is connected, so I know where to look for what code is needed for each step of the process. It appears PHP does not have an email, nor write to file and send option... (which makes sense that it doesn't.)
However what I need is the input forms data to be sent in email and then discarded from the website. I'm working on that now and have a few sites googled to look at.
This page appears to have what I'm looking for namely PHP ways to email data in clear description. It uses a PHP mail() function. http://htmldog.com/techniques/formtoemail/
I've also found code for how to add a button that let's the buyer set the dollar amount then put it into a paypal cart. You can't do that on the paypal account create buttons area. I've tested and it works! https://www.paypal-community.com/t5/About-Business-Archive/Can-you-create-an-Open-Amount-PayPal-button/td-p/651509
So cool, I went from no idea what tools to use, to all the bits and pieces solved, and now just have to work on how to string them together for specifically what I want (and have to learn error checking in these tools to add that code too.) Yay!! Thank you!!!
Upvotes: 3
Views: 5381
Reputation: 501
You can keep the input data using XAMPP MYSQL.
Languages you will most likely use maybe SQL and PHP.
ALso, you can use isset() function to 'transfer' the input into your MYSQL database.
For example, based on your form. we can create a database called myDB.
In myDB, we can create a table called 'user'.
From there, we can create columns for the table: fname,lname, interests.
You can refer to https://www.youtube.com/watch?v=FAXhXI2Gxdc on how to create database and tables.
Next we can insert the data input using the code below.
<?php
$con = mysqli_connect("localhost","root","password","myDB"); //connect to database
if (!$connect){
die('Could not connect: ' . mysqli_connect_errno()); //return error is connect fail
}
if(isset($_POST['submit']))
{
$fname= $_POST['fname'];
$lname= $_POST['lname'];
$areas= $_POST['areas'];
$query= $con->prepare ( "INSERT INTO user(fname,lname,areas) VALUES (?,?,?)");
$query -> bind_param("sss",$fname,$lname,$areas );
if ($query->execute())
{
echo"<center><strong>User added! </strong></center>";
} // display when user is added
else{
echo"Error in adding user!"; // display when there is error
}
}
?>
Here are some useful information you can refer to:
http://php.net/manual/en/function.isset.php
http://www.w3schools.com/php/php_mysql_connect.asp
http://php.net/manual/en/mysqli-stmt.bind-param.php
http://www.mustbebuilt.co.uk/php/insert-update-and-delete-with-mysqli/
Upvotes: 3