Jump to content

Update from form to MySQL database


Skelethor

Recommended Posts

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...
Link to comment
https://forums.phpfreaks.com/topic/7028-update-from-form-to-mysql-database/
Share on other sites

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.