WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search


Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - השוואת מחירים בסופר
ZeroLag.com
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : This program will take data from a user via a web based form, validate it, show it to the user for re-validation, and finally insert it into the database. Plenty of sanity checking on the fields in the form.
Categories : MySQL, HTML and PHP, PHP, Complete Programs, Databases Update Picture
Swift Griggs
Date : Nov 22nd 1998
Grade : 3 of 5 (graded 4 times)
Viewed : 29165
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Swift Griggs
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<html>
<body bgcolor="AAAAAA" text="000000"></body>
<title>Web and Email registration</title>
<!-- This was written with a text editor by Swift Griggs 11-10-98 -->
<center><table border=1 bgcolor="#086b5a" bordercolor="086b5a">
<tr><td><center><img src="reg.gif"><IMG SRC="logot.gif"></center></TD>
</tr>
</table></center>
<?
if (!$namef && !$insertval && !$submit) {
echo "<form action=\"/reg.php3\" method=\"post\">";
echo "<center>";
echo "<table align=\"center\" border=1 bordercolordark=\"#777777\" width=\"60%
\" bordercolorlight=\"#dddddd\" bgcolor=\"BBBBBB\">";
echo "<tr><td colspan=2 bgcolor=\"#000000\"><center><font color=\"#aaddaa\"> Jap
an Communication Inc.</font></center></td></td>" ;
echo "<tr><td>Your first name<br>";
echo "<td><input type=\"text\" name=\"namef\" maxlength=40
length=40><br></tr></td>";
echo "<tr><td>Your last name<br></td>";echo "<td><input type=\"text\" name=
\"namel\" maxlength=40 length=40><br></tr></td>";
echo "<tr><td>Your company name</td>";
echo "<td><input type=\"text\" name=\"coname\" maxlength=120 length=40><br></tr>
</td>";
echo "<tr><td>Your email address<br>";
echo "<A4><A4><A1><CB></td>";
echo "<td><input type=\"text\" name=\"email\" maxlength=60 length=40><br></tr></
td>";
echo "<tr><td>Your cell phone's number (numbers only please)";
echo "";
echo "<td><input type=\"text\" name=\"mobileset\" maxlength=15
length=40></tr></td>";
echo "<tr><td>A personal password<br>";
echo "</td>";
echo "<td><input type=\"password\" name=\"pass\" maxlength=40
length=40></tr></td>";
echo "<tr><td>A personal password (again)";
echo "</td>";
echo "<td><input type=\"password\" name=\"pass2\" maxlength=40 length=40></tr></
td>";
echo "<tr><td>Finish and submit data<br><BD><AA><CE><BB></td>";
echo "<td><center><input type=\"submit\" name=\"submit\" value=\"<C5><D0><CF>
<BF>\"></center></tr></td>";
echo "<tr><td colspan=2 bgcolor=\"#000000\"><center><font color=\"#aaddaa\">
Copyright 1998</font></center></td></td>" ;
echo "</table></center></form>";
} ?>
<?
if($pass != $pass2){
echo "<br><br><hr>You mispelled your password<hr><br><br>";
echo "Please <a href=\"/reg.php3\">go back</a> to correct this";
die;
}

if(!$insertval && $namef && $email && $namel && $pass && $coname) {
echo "<center><table border=1 bgcolor=\"#CCCCCC\"><tr><td colspan=6>" ;
echo "<br><center>You entered these values </center></td></tr>";
echo "<tr><td>First Name</td><td>Last Name</td><td>Company
Name</td><td>Email Address</td><td>";
echo "Phone Number</td><td>Password</td></tr>";
echo "<tr><td>$namef</td><td>$namel</td><td>$coname</td><td>
$email</td><td>mobileset</td><td>NOT SHOWN</td></tr>";
echo "</td></tr>";
echo "<form action=\"reg.php3\" method=\"post\">";
echo "<td colspan=3>Is all this data Correct?</td><td colspan=3>";
echo "<center><input type=\"submit\" value=\"Yes\" name=\"insertval\">";
echo "<input type=\"submit\" value=\"No\" name=\"insertval\">";
echo "<input type=\"hidden\" name=\"namef\" value=\"$namef\">";
echo "<input type=\"hidden\" name=\"namel\" value=\"$namel\">";
echo "<input type=\"hidden\" name=\"coname\" value=\"$coname\">";
echo "<input type=\"hidden\" name=\"email\" value=\"$email\">";
echo "<input type=\"hidden\" name=\"mobileset\" value=\"$mobileset\">";
echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\">";
echo "<input type=\"hidden\" name=\"pass2\" value=\"$pass2\">";
echo "</form></table></center></center>";
} elseif($insertval == "No") {
echo "<font size=+2><center><br><br><hr>If you made a mistake, ";
echo "Click <a href=\"/reg.php3\">here</a> to start
over<hr></font></center><br><br>";
}
if((!$namef || !$email || !$namel || !$pass || !$coname || $insertval) &&
$submit) {
echo "<font size=+1><center><br><br><hr>";
echo "You <font color=\"#FF0000\"><b>must</b></font> enter data in the
following fields:<br>";
echo "First name, Last Name, email, Company Name, and password";
echo "Click <a href=\"/reg.php3\">here</a> to start over";
echo "</font></center><hr><br><br>";
}
if($insertval == "Yes"){
mysql_connect("localhost","root","mypassword")
or die("Unable to connect to MySQL server");
mysql_select_db("register") or die("Unable to select database");
$insert = mysql_query("insert into users VALUES(
'$namef','$namel','$coname','$email','$mobileset',password
('$pass'),NULL)");
echo "<br><br><b><font size=+4><font color=\"66FF66\"><center>Your data has
been successfully entered.";
echo "</b></center></font></font>";
}
?>
<center><table border=1 width="90%"
bgcolor="#086b5a"><tr><td><FORM><center><font color="FFFFFF">
<INPUT bgcolor="#AAFFAA"type="button" value="Main Menu"
OnClick="location='./index.html'"></font></form></td>
</center>
<TD><font color="DD5555"><center><h1>Widget
Inc.</h1>company name here</center></td></tr></table></center>

</html>




bookmarker - PHP, PHPLIB, MySQL WWW based bookmark manager
Categories : MySQL, PHP, MySQL, Complete Programs, Databases
DDN FFA Network Script
Categories : PHP, MySQL, Complete Programs, HTML and PHP, Databases
This program allows you to upload an ODBC ressource - i.e. an MS-Access database to a MySQL server.
Categories : Databases, MySQL, Complete Programs, PHP, Databases
Create and restore backup of MySQL databases
Categories : MySQL, Databases, PHP, PHP Classes, Complete Programs
BBS system for easy customization. Utilizes mySQL.
Categories : Complete Programs, MySQL, PHP, Databases
Pull Down Surfing - Surf on Change
Categories : Java Script, MySQL, HTML and PHP, PHP, Databases
Functions for loading images into a MySQL database and displaying them.
Categories : Graphics, HTML and PHP, MySQL, PHP, Databases
Dynamically generated pop-ups (Select items)
Categories : PHP, HTML and PHP, MySQL, Databases
Tropicalm Genetree Family (MySQL based family tree)
Categories : PHP, Interfaces, Databases, MySQL, Complete Programs
Point and Click Interface ala MS Access for creating SQL statements.
Categories : MySQL, Complete Programs, General SQL, PHP, Databases
Example voting script. Lets people enter suggestions and vote for existing ones.
Categories : MySQL, PHP, Cookies, Complete Programs, Databases
Database resultset navigation
Categories : PHP, HTML and PHP, Databases, MySQL, Navigation
This is a very simple BBS that uses MySQL
Categories : MySQL, Databases, Complete Programs, PHP
Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs.
Categories : Databases, PHP, MySQL, Complete Programs
AITSH Guestbook
Categories : Complete Programs, HTML and PHP, Databases, MySQL
 Joo Oliveria wrote : 14
Very well. Your contribution for my learning.  Thenk you.
 
 Varinder Tandon wrote : 131
Where is your reg.php3, i just want to see how u 
connact the databse with html for.
 
 Andras Jokuti wrote : 211
Tandon:
You should name THIS file reg.php3!

Yoko
 
 Raja Komkom Siregar wrote : 217
What about the table of register database?
 
 Vulinh Nguyen wrote : 303
The block code:
Visitors should be informed which field(s) they forgot to 
fill out. You program displays  the messages which 
indicates that the visitor has left out all the required 
fields. But in reality, they just left out one required field 
only. I have added the short code to your program to 
catch up the empty fields:

In the code block:
if((!$namef || !$email || !$namel .......)
{
   echo "&lt;font size=+1&gt;&lt;center&gt;&lt;br&gt;&lt;br&gt;&lt;hr&gt;";
   echo "You &lt;font color=\"#FF0000
\"&gt;&lt;b&gt;must&lt;/b&gt;&lt;/font&gt;enter data in the following 
fields:&lt;br&gt;"
  if(!$namef) echo "First name, ";
  if(!$namel) echo "Last name, ";
  //and so on.....

}
 
This would inform visitors which fields were actually left 
empty!
 
 tonto kea wrote :598
Well, table structure would be nice. Couse i didn`t get it work...