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
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!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.