Where do I start

General discussions related to php

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Thu Aug 14, 2014 8:37 pm

Where do I start

Postby Usernamename » Thu Aug 14, 2014 8:44 pm

I don’t know where to post this because I don't know the simplest way to do this.
I want the simplest and fastest way to simply get info entered in three form boxes.
Box one
Box two
Box three
Don’t care if they don’t fill out one box, just let me see what is going on.
I tried using an in line php mailer script and used the one send email address that my hosting company said might work I still get forbidden.
I set up a mysql database but getting a php script to write to it and reading it I’m not sure all the steps.

what path should I take?! where do I even start!

User avatar
php-forum Active User
php-forum Active User
Posts: 335
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Where do I start

Postby freshnet » Sat Oct 18, 2014 5:13 pm

The easiest way is to set up a mysql database. Without knowing more about what you want to do and why, I can't tell you the exact structure you'd use, but you could just use one table like this:

TABLE: id, box1, box2, box3

When the form is submitted, you'd get the $_POST['box1'] etc. and insert them into the database using something like this (with mysqli or PDO). Obviously this isn't all you'd need, but it should get you started.

Code: Select all

$box1 = $_POST['box1'];
$box2 = $_POST['box2'];
$box3 = $_POST['box3'];

$insertQuery = "INSERT INTO table (box1, box2, box3) VALUES ('$box1', '$box2', '$box3')";

if (mysqli_query($link, insertQuery) === TRUE)
    echo "Result stored";

To read back the database, you'd just want a SELECT query:

Code: Select all

$selectQuery = "SELECT box1, box2, box3 FROM table";
$result = mysqli_query($link, $selectQuery);

while ($row = mysqli_fetch_array($result))
echo $row[0]."<br/>";
echo $row[1]."<br/>";
echo $row[2]."<br/>";

Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest