₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,220 members, 8,420,876 topics. Date: Friday, 05 June 2026 at 01:12 PM

Toggle theme

Ford705's Posts

Nairaland ForumFord705's ProfileFord705's Posts

1 2 (of 2 pages)

WebmastersAgain Fellas, What's Wrong With My Code: It Keeps Giving Me The Error Message by ford705(op): 9:18pm On Aug 17, 2011
what now
WebmastersRe: Why Is My Code Not Working by ford705(op): 5:45pm On Jul 30, 2011
Thanks!

I'm keen on you helping me, lol,
WebmastersRe: Why Is My Code Not Working by ford705(op): 5:38pm On Jul 30, 2011
Ok fellas. Another little question

How do i restrict access to a particular page using PHP and allowing access from the Login page.


Thanks
WebmastersRe: Why Is My Code Not Working by ford705(op): 5:21pm On Jul 30, 2011
ddual core: what is disapointing?
Istead of telling a brother what to do, you were having fun
BusinessRe: Anambra To Build 260mw Power Station by ford705(m): 3:11pm On Jul 30, 2011
I love this, Finally it seems like Obi is working again
WebmastersRe: Why Is My Code Not Working by ford705(op): 2:50pm On Jul 30, 2011
Thanks a lot dell_net, to others, dont laugh at a beginner encourage Him to be the best
WebmastersRe: Why Is My Code Not Working by ford705(op): 12:11pm On Jul 30, 2011
This is the HTML





<?php


//1. create a database connection
$connection = mysql_connect("localhost", "root", ""wink;
if (!$connection) {
die("Database connection failed:" . mysql_error());
}
//2. Select a database to use
$db_select = mysql_select_db("ectforu",$connection);
if (!$db_select) {
die("Database Selection failed: " . mysql_error());
}


?>


<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>

<style>
#container{
margin: 0 auto;
width: 800px;
height:800px;
background-color:#CF9;
}
h1{
text-shadow:#333;
text-align:center;
}
p{
/*padding-left: 300px;*/
text-align:center;
}

</style>
</head>

<body>
<br>
<div id="container">
<h1>ECT final year forum</h1>
<h1>Insert Your Details Accordingly</h1>
<form action="insert.php" method="post" >
<p><label for="textfield">Surname &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="surname" id="surname">
</p>
<p> <label for="textfield2">OtherNames</label>
<input type="text" name="othernames" id="othernames">
</p>
<p> <label for="textfield2">Sex&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="sex" id="sex">
</p>
<p> <label for="textfield2">Phone&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="phone" id="phone">
</p>
<p> <label for="textfield2">Contact Address</label>
<input type="text" name="contactadd" id="contactadd">
</p>
<p> <label for="textfield2">Email Address&nbsp;&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="emailadd" id="emailadd">
</p>
<p> <label for="textfield2">Birthday&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
<input type="text" name="birthday" id="birthday">
</p>
<p> <textarea name="philosophy" cols="35" rows="7">Philosophy in Life</textarea>
</p>
<p>
<textarea name="worstday" cols="35" rows="7">Worst Day in School</textarea>
</p>
<p>
<input name="Click to Submit" type="button" value="submit"></p>
</form>

</div>
</body>
</html>
<?php
mysql_close($connection);
?>
WebmastersWhy Is My Code Not Working by ford705(op): 12:10pm On Jul 30, 2011
<?php


//1. create a database connection
$connection = mysql_connect("localhost", "root", ""wink;
if (!$connection) {
die("Database connection failed:" . mysql_error());
}
//2. Select a database to use
$db_select = mysql_select_db("ectforu",$connection);
if (!$db_select) {
die("Database Selection failed: " . mysql_error());
}


?>
<?php
$id=$_POST['id'];
$surrname=$_POST['username'];
$othernames=$_POST['othernames'];
$sex=$_POST['sex'];
$phone=$_POST['phone'];
$contactadd=$_POST['contactadd'];
$emailadd=$_POST['emailadd'];
$birthday=$_POST['birthday'];
$philosophy=$_POST['philosophy'];
$worstday=$_POST['worstday'];
?>

<?php
$query="INSERT INTO details (id, surname, othernames, sex, phone, contactadd, emailadd, birthday, philosophy, worstday)
VALUES('{$id}', '{$surname}', '{$othernames}', '{$sex}', '{$phone}', '{$contactadd}', '{$emailadd}', '{$birthday}', '{$philosophy}', '{$worstday}')";

if(mysql_query($query, $connection)) {
//sucess
header("location: success.html"wink;
exit;
} else {
//error message
echo "<p> insertion failed. </p>";
echo "<p> .mysql_error(). </p>";

}
?>

<?php
mysql_close($connection);
?>

1 2 (of 2 pages)