Question

Using MySQL and PHP keep it simple This assignment you will be making a form that...

Using MySQL and PHP keep it simple

This assignment you will be making a form that will do one of three things in a database

-          It will add a record

-          It will update a record

-          It will search for a record

Your database will contain a table for keeping a record of all your friends and family and should contain:

First name

Last name

Phone number

Address

City

State

Zip

Birthdate

Username

Password

The sex of the person

And the relationship

You should also keep a primary key for the user

You will then have two pages a friends and family form page and a results page

The form will ask the user to enter the information and then choose to either

Create a new record

Update and existing record

Search for a record

The results page will display the information that they are requesting with either adding a record, updating it or displaying the results of a record.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

rg table:

CREATE TABLE rg(

uid int(11) not null AUTO_INCREMENT PRIMARY KEY,
user_fn varchar(256),
user_ln varchar(256),
user_pn varchar(256),
user_address varchar(256),
user_city varchar(256),
user_state varchar(256),
user_zip varchar(256),
user_bd varchar(256),
user_uid varchar(256),
user_pwd varchar(256),
user_gender varchar(256),
user_relation varchar(256),

);

index.php:

<html>

<frameset rows="7%,*" border=1%>

<frame name="menu" src="menu.php" noresize="noresize">

<frame name="top" src="top.php" noresize="noresize">

</frameset>

</html>

menu.php:

<!DOCTYPE html>

<html>

<head>

<style type="text/css">

.h{

text-decoration: none;

color: white;

}

table{

width: 400px;

height: 30px;

color:black;

border-collapse: collapse;

}

th{

border-top:0px solid;

}

body{

background-color: black;

}

.r{

text-decoration: none;

color: red;

}

</style>

regist.php:

<html>

<head>

<script type="text/javascript">

funtion fd()

{

var ele=document.getElementsById('nm');

var val=ele.value;

if(val==null)

{

alert("enter your name");

}

}

</script>

<style>

table{

border:1px solid white;

background-color:white;

}

button{

}

.in{

border.radius:2px;

}

body{

background-color:#fdf;

}

.t{

border-style: outset;

border-width: 7px;

border-color: white;

background-color: skyblue;

height: 400px;

}

</style>

</head>

<body>

<h1 align="center">REGISTRATION<h1>

<form action="link.php" method="POST">

<table align="center" class="t">

<tr>

<td>First name: </td>

<td><input type="text" name="fn" value="" class="in" ></td>

</tr>

<tr>

<td>Last name: </td>

<td><input type="text" name="ln" value="" class="in" ></td>

</tr>

<tr>

<td>Phone number: </td>

<td><input type="text" name="pn" value="" class="in" ></td>

</tr>

<tr>

<td>Phone number: </td>

<td><input type="text" name="pn" value="" class="in" ></td>

</tr>

<tr>

<td>Address:</td>

<td>

<textarea rows="3" cols="20" name="address">

</textarea>

</td>

</tr>

<tr>

<td>City:</td>

<td><input type="text" name="city" value="" class="in" ></td>

</tr>

<tr>

<td>State:</td>

<td><input type="text" name="state" value="" class="in" ></td>

</tr>

<tr>

<td>Zip:</td>

<td><input type="text" name="zip" value="" class="in" ></td>

</tr>

<tr>

<td>Birthdate:</td>

<td><input type="date" name="bd" value="" class="in" ></td>

</tr>

<tr>

<td>

Username:

</td>

<td><input type="text" name="uid"></td>

</tr>

<tr>

<td>

Password:

</td>

<td>

<input type="Password" name="pwd">

</td>

</tr>

<tr>

<td>Gender: </td>

<td><input type="radio" name="Gender" value="M">M

<input type="radio" name="Gender" value="F">F

</td>

</tr>

<tr>

<td>Relationship status: </td>

<td><input type="checkbox" name="relation" value="Single">Single

<input type="checkbox" name="relation" value="Married">Married

</td>

</tr>

<tr>

<td><td><button onclick=fd()>Register</button>

</tr>

</table>

</form>

</body>

</html>

home.php:

<!DOCTYPE html>

<html>

<head>

<style>

body{

background-color: #ddd;

}

</style>

</head>

<body>

<?php

include_once 'top.php';

?>

</body>

</html>

top.php:

<!DOCTYPE html>

<html>

<head>

<style type="text/css">

.tt{

float: right;

border-style: outset;

border-width: 7px;

border-color: white;

background-color: skyblue;

height: 200px;

}

input[type=text], input[type=password] {

width:250px;

padding: 12px 20px;

margin: 4px 3px;

display: outline-block;

border: 1px solid #ccc;

}

body{

margin-top: 50px;

}

.r{

text-decoration: none;

color: red;

}

.b:hover{

color: red;

background-color: blue;

}

h2{

padding:0 0 50 0;

}

.b{

background-color: lightgreen;

width: 200px;

height: 50px;

}

button{

margin-bottom: 20px;

width:100px ;

height:30px ;

}

button:hover{

background-color: #ccc;

}

</style>

</head>

<body bgcolor="silver">

<form action="loginlink.php" method="POST">

<table class="tt">

<tr>

<td>

<h2 align="center">LOGIN</h2>

</td>

</tr>

<tr>

<td>Username: </td></tr>

<tr><td><input type="text" name="uid" placeholder="Enter username"></td></tr>

<tr><td>Password: </td></tr>

<tr><td><input type="password" name="pwd" placeholder="Enter password"></td></tr>

<tr>

<td>

<button>LOGIN </button>

</td>

</tr>

</table>

</form>

</body>

</html>

new.php:

<!DOCTYPE html>

<html>

<head>

<style type="text/css">

.t{

text-decoration:none;

float: right;

}

</style>

<title>

</title>

<h1>You are logged in successfully</h1>

</head>

<body>

Clicl here to.....

<a href="logout.php" class="t">Logout</a><br>

</body>

</html>

logout.php:

<?php

session_start();

if(session_destroy())

{

header("location:top.php");

}

?>

loginlink.php:

<?php

$servername= "localhost";
$username= "cse";
$password= "cse";
$dbname= "cse";
$conn = mysqli_connect($servername,$username,$password,$dbname);

$uid=$_POST['uid'];
$pwd=$_POST['pwd'];
SESSION_start();

if(empty($uid) && empty($pwd))
{
header("Location:top.php");
}
else

{
$sql="SELECT * FROM rg WHERE (user_username='$uid') And (user_password='$pwd')";


if($res=mysqli_query($conn,$sql))

{
$rowcount=mysqli_num_rows($res);


if($rowcount>=1)
{
$_SESSION['user_username']=$uid;
header("location:new.php");

}
else
{
header("location:fail.php");
}
}

}

?>

link.php:

<?php

$servername= "localhost";

$username= "cse";

$password= "cse";

$dbname= "cse";

$conn = mysqli_connect($servername,$username,$password,$dbname);

$First name= $_POST['fn'];

$Last name= $_POST['ln'];

$Phone number= $_POST['pn'];

$address= $_POST['address'];

$City= $_POST['city'];

$State= $_POST['state'];

$Zip= $_POST['zip'];

$Birthdate= $_POST['bd'];

$username= $_POST['uid'];

$password= $_POST['pwd'];

$gender= $_POST['Gender'];

$Relationship status= $_POST['relation'];

$sql= "INSERT INTO rg(use<style type="text/css">

</style>r_First name,user_Last name,user_Phone number,user_address,user_City,user_State,user_Zip,user_Birthdate,user_username,user_password,user_gender,user_Relationship status)

VALUES('$First name','$Last name','$Phone number','$address','$City','$State','$Zip','$Birthdate','$username','$password','$gender','$Relationship status')";

if(mysqli_query($conn, $sql))

{

echo "Registration Successful";

}

?>

getdata.php:

<?php

include_once 'style.css';

?>

<?php

$servername= "localhost";

$username= "cse";

$password= "cse";

$dbname= "cse";

$conn = mysqli_connect($servername,$username,$password,$dbname);

$sql="SELECT * FROM rg";

$res=mysqli_query($conn,$sql);

echo "<h2>REGISTRATIONS LIST</h2>";

echo "<table> <tr> <th>First name</th> <th>Last name</th> <th>Phone number</th> <th>Address</th> <th>City</th> <th>State</th> <th>Zip</th> <th>Birthdate</th> <th>Username</th> <th>Gender</th> <th>Relationship status</th> </tr> ";

while($row=mysqli_fetch_assoc($res))

{

echo "<tr>";

echo "<td>".$row['user_First name']."</td>";

echo "<td>".$row['user_Last name']."</td>";

echo "<td>".$row['user_Phone number']."</td>";

echo "<td>".$row['user_address']."</td>";

echo "<td>".$row['user_City']."</td>";

echo "<td>".$row['user_State']."</td>";

echo "<td>".$row['user_Zip']."</td>";

echo "<td>".$row['user_Birthdate']."</td>";

echo "<td>".$row['user_username']."</td>";

echo "<td>".$row['user_Relationship status']."</td>";

echo "<td>".$row['user_language']."</td>";

echo "</tr>";

}

echo "</table>";

?>

fail.php:

<!DOCTYPE html>

<html>

<head>

<style type="text/css">

.g{

text-decoration: none;

}

</style>

<h2>Invalid username or password</h2>

</head>

<body>

To Try Again......<a href="top.php" class="g">Click here</a>

</body>

</html>

style.css:

<html>

<style>

table{

border-color: black;

background-color:skyblue ;

width: 1000px;

border-width: 5px;

}

tr,th{

border-width: 2px;

}

</style>

</html>

Add a comment
Know the answer?
Add Answer to:
Using MySQL and PHP keep it simple This assignment you will be making a form that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using PHP and MYSQL create a form that: user Full name user Comment (as many lines...

    Using PHP and MYSQL create a form that: user Full name user Comment (as many lines as they want) allows the user to attach one image uploads the Full name, comment, and image to a database Displays the user's full name, comment and user image on the website by selecting them from the database. Include the server connection file as well any necessary codes to connect and maintain the database

  • How can I print the Database table in PHP please ? here I have form for name and email, also I have php code that allow...

    How can I print the Database table in PHP please ? here I have form for name and email, also I have php code that allow user to add his name and email to my database, all I need to print my final database when the user click on submit. <form action="" method="post"> <label>Name :</label> <input type="text" name="name" required="required" placeholder="Please Enter Name"/><br /><br /> <label>Email :</label> <input type="email" name="email" required="required" /><br/><br /> <input type="submit" value=" Submit " name="submit"/><br /> </form>...

  • You need to implement a web application that is split in three parts, namely, Webpage, PHP and My...

    You need to implement a web application that is split in three parts, namely, Webpage, PHP and MySQL. Each of them will be used accordingly to solve a simple problem described below. Remember to implement the logic in the most secure way of your knowledge. PHP Implement a PHP function that reads in input a string from the user and store it in a table (e.g., in a field called "Content Name"). The function should be able to read the...

  • Using PHP and MySQL, create a Web page to be used for storing software development bug reports in...

    Using PHP and MySQL, create a Web page to be used for storing software development bug reports in a MySQL database. Include fields such as product name and version, type of hardware, operating system, frequency of occurrence, and proposed solutions. Include links on the main page that allow you to create a new bug report and update an existing bug report. I have tried the various solutions provided previously for this exercise, but it does not work because every author...

  • For this code below, I need to add the form information to mysql when I click...

    For this code below, I need to add the form information to mysql when I click on submit, at the same time when I click on submit I need to move to another page like Welcome.php WITH NOTE THAT THE ENTERED INFORMATION NOW ALREADY IN DATABASE how can I male that with my code below? THANKS ................................................................................................................................................   <form method="POST"> <div class="container">    <label for="fname"><b>First Name</b></label> <input type="text" placeholder="Enter First Name" name="fname" required> <label for="lname"><b>Last Name</b></label> <input type="text" placeholder="Enter Last Name"...

  • I need help please to add function for clean up any inputs form that we receive from the users for this code below : &lt...

    I need help please to add function for clean up any inputs form that we receive from the users for this code below : <?php session_start(); // initializing variables $fname = ""; $lname = ""; $address = ""; $city = ""; $state = ""; $zip = ""; $email = ""; $phone = ""; $errors = array(); // connect to the database $db = mysqli_connect("localhost","root","password","db"); // REGISTER USER if (isset($_POST['reg_user1'])) { // receive all input values from the form $fname =...

  • PHP you need to create a form to allow the user to enter their name, email,...

    PHP you need to create a form to allow the user to enter their name, email, and address information. That information will be sent to a PHP script that will process and display that information. Your assignment should have two pages. The first page is straight html (user_input.html) that has a form with the appropriate form elements to collect the user input. The form should then be submitted using the POST method to a php script (display_user_info.php) that will process...

  • Can you please upload the video to step by step with eclipse and mysql workbench.please.............

    Can you please upload the video to step by step with eclipse and mysql workbench.please................................ Part 1 Design the database using the ER approach. Then using Java and SQL, implement the following functionality: 1. Implement a button called “Initialize Database” . When a user clicks it, all necessary tables will be created (or recreated) automatically, with each table be populated with at least 10 tuples so that each query below will return some results. All students should use the database...

  • The first script is validate.sh. This is a simple form validation script that will be used...

    The first script is validate.sh. This is a simple form validation script that will be used to verify the inputs given. Normally, this would be done to validate input from a website or another program before entry into a database or other record storage. In this case, we will keep it simple and only focus on the input validation step. In particular, the script should prompt the user for four values: first name, last name, zip code, and email address....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT