Ford705's Posts
Nairaland Forum › Ford705's Profile › Ford705's Posts
1 2 (of 2 pages)
what now |
Thanks! I'm keen on you helping me, lol, |
Ok fellas. Another little question How do i restrict access to a particular page using PHP and allowing access from the Login page. Thanks |
ddual core: what is disapointing? Istead of telling a brother what to do, you were having fun |
I love this, Finally it seems like Obi is working again |
Thanks a lot dell_net, to others, dont laugh at a beginner encourage Him to be the best |
This is the HTML <?php //1. create a database connection $connection = mysql_connect("localhost", "root", "" ;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 </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 </label> <input type="text" name="sex" id="sex"> </p> <p> <label for="textfield2">Phone </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 </label> <input type="text" name="emailadd" id="emailadd"> </p> <p> <label for="textfield2">Birthday </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); ?> |
<?php //1. create a database connection $connection = mysql_connect("localhost", "root", "" ;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" ;exit; } else { //error message echo "<p> insertion failed. </p>"; echo "<p> .mysql_error(). </p>"; } ?> <?php mysql_close($connection); ?> |
1 2 (of 2 pages)
;