GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 02-Apr-2008, 14:15
wedel wedel is offline
New Member
 
Join Date: Jun 2007
Posts: 20
wedel is on a distinguished road

problem in sending data to the database


PHP Code:

<html>
<body>
<?php
if(isset($_POST['Insert']))
{
    

 // This is the name of the database i made.
    $db = mysql_connect("localhost","root","")  or die('connection error '.mysql_error());
     // 
    mysql_select_db('mybase',$db)  or die('selection error '.mysql_error()); 
    $login=$_POST['login'];
    $password=$_POST['password'];
    $first=$_POST['first'];
    $last=$_POST['last'];
    $Email=$_POST['Email'];

      // 
    $sql = "INSERT INTO user (login,first,last,password,Email) VALUES('$login','$password','$first','$last','$Email')"; // on insère les informations du formulaire dans la table 
    mysql_query($sql) or die('Error !'.$sql.'<br>'.mysql_error()); 
 // 
  
    mysql_close();  // close the connection 
  echo 'a new user has benn added.'; 
}
else
{
?>
    
<form  method="POST">
Login:<br><input type="text" name="login" id="login"><br>
Password:<br><input type="text" name="password" id="password"><br>
First name:<br><input type="text" name="first" id="first"><br>
Last name:<br><input type="text" name="last" id="last"><br>
E-mail:<br><input type="text" name="Email" id="Email"><br>
<br><input type="submit" value="Insert" id="Insert"><br>
</form>
<?php 
}
?>
</body>
</html> 

 
 

Recent GIDBlogProgramming ebook direct download available by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Memory leak when nothing is happening... How can I even debug this ? Algar MS Visual C++ / MFC Forum 10 19-Nov-2007 08:17
[Include] Doubly-linked List dsmith C Programming Language 6 14-Apr-2006 14:12
Strange C++ code memory leakage problem gaoanyu C++ Forum 7 04-Nov-2005 09:09
[GIM] Data Module - Contact dsmith C Programming Language 2 27-Jan-2005 17:30
[CONTEST?]Data Structure Test dsmith C Programming Language 2 06-Jun-2004 16:13

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 07:51.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.