Jump to content


Photo

Update from form to MySQL database


  • Please log in to reply
1 reply to this topic

#1 Skelethor

Skelethor
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 April 2006 - 03:34 PM

Here is my code:

<?php
$username="Administrator";
$password="********";
$database="newstravel";

$loginnaam=$_POST['txtLoginnaam'];
$lpaswoord=$_POST['txtPaswoord'];
$voornaam=$_POST['txtVoornaam'];
$naam=$_POST['txtNaam'];
$adres=$_POST['txtAdres'];
$email=$_POST['txtEmail'];

mysql_connect(localhost,$username,$password);

@mysql_select_db($database) or die( "Kan de databank niet selecteren!");

$query = "INSERT INTO login VALUES ('','$loginnaam','$paswoord','$voornaam','$naam',' $adres','$email')";
mysql_query($query);

$query="SELECT * FROM login";
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();

echo "<b><center>Overzicht leden</center></b><br><br>";

$i=0;
while ($i < $num) {

$loginnaam=mysql_result($result,$i,"Loginnaam");
$paswoord=mysql_result($result,$i,"Paswoord");
$voornaam=mysql_result($result,$i,"Voornaam");
$naam=mysql_result($result,$i,"Naam");
$adres=mysql_result($result,$i,"Adres");
$email=mysql_result($result,$i,"E-mail");

echo " Loginnaam: $loginnaam Paswoord: $paswoord Voornaam: $voornaam Naam: $naam Adres: $adres E-mail: $email";

$i++;
}


?>

And here is the code of my little form:

<form method="post" action"insert.php">

<table width="50%" border="0">
<tr>
<td>Voornaam:</td>
<td><input type="text" name="txtVoornaam"></td>
</tr>
<tr>
<td>Naam:</td>
<td><input type="text" name="txtNaam"></td>
</tr>
<tr>
<td>Adres:</td>
<td><input type="text" name="txtAdres"></td>
</tr>
<tr>
<td>Loginnaam:</td>
<td><input type="text" name="txtLoginnaam"></td>
</tr>
<tr>
<td>Paswoord:</td>
<td><input type="text" name="txtPaswoord"></td>
</tr>
<tr>
<td>E-mail:</td>
<td><input type="text" name="txtEmail"></td>
</tr>
</table>
<p>
<input type=submit name="cmdOpslaan" value="Verzenden">
</p>
<p>
</form>


I don't know what's wrong. But it just don't works...

Thx allready...

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 10 April 2006 - 03:40 PM

Its pretty helpful when you say it doesn't works! Do you get any errors while running the code? Whats parts dont work? Whats the script supposed to do?

Helps if you provide a few more details about your probelm rather than posting code and day it doesn't works!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users