PostgreSQL and PHP forms
Posted
by MrEnder
on Stack Overflow
See other posts from Stack Overflow
or by MrEnder
Published on 2010-03-22T05:21:44Z
Indexed on
2010/03/22
5:31 UTC
Read the original article
Hit count: 465
Ok I have a PostgreSQL server with a Database titled brittains_db that I only have PuTTY access to. I can also upload via FTP to the web server which has access to PostgreSQL and the Database somehow...
I have made a SQL file named logins.sql
CREATE TABLE logins(
userName VARCHAR(25) NOT NULL PRIMARY KEY,
password VARCHAR(25) NOT NULL,
firstName NOT NULL,
lastName NOT NULL,
ageDay INTEGER NOT NULL,
ageMonth INTEGER NOT NULL,
ageYear INTEGER NOT NULL,
email VARCHAR(255) NOT NULL,
createDate DATE
)
Then I made a form to get all that information.
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
<table>
<tr>
<td class="signupTd">
First Name:
</td>
<td>
<input type="text" name="firstNameSignupForm" value="<?php echo $firstNameSignup; ?>" size="20"/>
</td>
<td>
<?php echo $firstNameSignupError; ?>
</td>
</tr>
... code continues
I had it save all the information in variables if page run on POST
$firstNameSignup=trim($_POST["firstNameSignupForm"]);
$lastNameSignup=trim($_POST["lastNameSignupForm"]);
$userNameSignup=trim($_POST["userNameSignupForm"]);
$passwordSignup=trim($_POST["passwordSignupForm"]);
$passwordConfirmSignup=trim($_POST["passwordConfirmSignupForm"]);
$monthSignup=trim($_POST["monthSignupForm"]);
$daySignup=trim($_POST["daySignupForm"]);
$yearSignup=trim($_POST["yearSignupForm"]);
$emailSignup=trim($_POST["emailSignupForm"]);
$emailConfirmSignup=trim($_POST["emailConfirmSignupForm"]);
All information was then validated Now comes the points where I need to upload it to PostgreSQL
How do I put my table in Postgre? How do I insert my information into my table?
and how would I recall that information to display it?
© Stack Overflow or respective owner