You are here: php - inserting info into a database « PHP Programming Language « IT news, forums, messages
php - inserting info into a database

Posted by comp_guy on 03/23/06 21:06

hey guys, can anyone see where im going wrong in my code below? i am
making a registration form on a webpage before using php to send the
input data into a mySQL database. first off is the code for the
registration form:


<form method = "POST" action="display.php"
onSubmit="returnverifyform(this)">

<h1> Please fill in all fields below to register: </h1> Title:

<select name = "title">
<option selected>Please select..
<option>Mr
<option>Mrs
<option>Miss
</select><br>

<br>First name: <input type ="text" name = "first">
<font color = "black"></font><br>

<br>Last name: <input type = "text" name = "last">
<font color="black"></font><br>

<br>Age:
<select name = "age">
<option selected>Please select..
<option>25
<option>26
<option>27
<option>28
<option>29
<option>30
<option>31
<option>other
</select><br>

<br>Subject:
<select name ="subject">
<option selected>Please select..
<option>Computer Science
<option>Science
<option>English
<option>Maths
<option>Architecture
<option>Business
<option>Dentistry
<option>Earth, Ocean and Planetary Science
<option>Engineering
<option>European Studies
<option>History and Archaeology
<option>Journalism, Media and Cultural Studies
<option>Law
<option>Medicine
<option>Music
<option>Religious and Theological Studies
<option>Welsh
<option>Other
</select><br>

<br>Initial Year of Study:
<select name = "year">
<option selected>Please select..
<option>1990
<option>1991
<option>1992
<option>1993
<option>1994
<option>1995
<option>1996
<option>1997
<option>1998
<option>1999
<option>other
</select><br>

<br>Email Address: <input type = "text" name = "email">
<font color="black"></font><br>

<br>User Name: <input type = "text" name = "user_name">
<font color="black"></font><br>

<br>Password: <input type = "password" name = "password">
<font color="black"></font><br>

<br><input type="submit" name = "Send" value = "Send">

</form>

next off is the code using php:
<?php

$connection =
mysql_connect("sentinel.cs.cf.ac.uk","scm5sjc","my_password_here");
mysql_select_db("sjcdb",$connection)or die("failed!");

$title=$_POST['title'];
$first=$_POST['first'];
$last=$_POST['last'];
$age=$_POST['age'];
$subject=$_POST['subject'];
$year=$_POST['year'];
$email=$_POST['email'];
$user_name=$_POST['user_name'];
$password=$_POST['password'];

mysql_query("INSERT INTO info VALUES ('',
'$title','$last','$age',$subject','$year','$email','$user_name','$password')",$connection);
mysql_close(connection);

?>

anyone know where im going wrong??
cheers

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация