niets doen??
gothmog - 19/06/2005 19:34
Lid
als ik hier allemaal waardes intyp, doet het niks, hier het script:
<?php
echo "
<form name='top10insert' action='index.php?inh=toevoegen' METHOD='POST'>
<table width='500' border='1' bordercolor='black' cellspacing='0'>
<tr><td>Plek: $obj->plek</td><td><input type='text' name='plekk'></td></tr>
<tr><td>Naam: $obj->naam</td><td><input type='text' name='naamm'></td></tr>
<tr><td>Link: $obj->link</td><td><input type='text' name='linkk'></td></tr>
<tr><td>Size: $obj->size</td><td><input type='text' name='sizee'></td></tr>
<tr><td>Bestand: $obj->bestandsnaam</td><td><input type='text' name='bestandd'></td></tr>
<tr><td><input type='reset' value='reset' NAME='reset'> </td><td><input type='submit' value='Send' name='submit'></td></tr>
</table>";
if(isset($_POST['top10insert'])){
$insert = "INSERT INTO top10 ('naam', 'size', 'link', 'plek', 'bestandsnaam') VALUES ('$naamm', '$sizee', '$linkk', '$plekk', '$bestandd')";
mysql_query($insert) or die (mysql_error());
echo "Toegevoegd";
}
?>
<?php
<form name='top10insert' action='index.php?inh=toevoegen' METHOD='POST'>
<table width='500' border='1' bordercolor='black' cellspacing='0'>
<tr><td>Plek: $obj->plek </td><td><input type='text' name='plekk'></td></tr>
<tr><td>Naam: $obj->naam </td><td><input type='text' name='naamm'></td></tr>
<tr><td>Link: $obj->link </td><td><input type='text' name='linkk'></td></tr>
<tr><td>Size: $obj->size </td><td><input type='text' name='sizee'></td></tr>
<tr><td>Bestand: $obj->bestandsnaam </td><td><input type='text' name='bestandd'></td></tr>
<tr><td><input type='reset' value='reset' NAME='reset'> </td><td><input type='submit' value='Send' name='submit'></td></tr>
</table>" ;
if ( isset ( $_POST [ 'top10insert' ] ) ) { $insert = "INSERT INTO top10 ('naam', 'size', 'link', 'plek', 'bestandsnaam') VALUES ('$naamm ', '$sizee ', '$linkk ', '$plekk ', '$bestandd ')" ;
}
?>
wat is fout?
7 antwoorden
Gesponsorde links
zwobbel - 19/06/2005 19:45 (laatste wijziging 19/06/2005 19:47)
PHP gevorderde
Wat doet hij juist niet de data in de database steken?
Vervang u script is met deze versie
<?
echo "
<form name='top10insert' action='index.php?inh=toevoegen' METHOD='POST'>
<table width='500' border='1' bordercolor='black' cellspacing='0'>
<tr><td>Plek: $obj->plek</td><td><input type='text' name='plekk'></td></tr>
<tr><td>Naam: $obj->naam</td><td><input type='text' name='naamm'></td></tr>
<tr><td>Link: $obj->link</td><td><input type='text' name='linkk'></td></tr>
<tr><td>Size: $obj->size</td><td><input type='text' name='sizee'></td></tr>
<tr><td>Bestand: $obj->bestandsnaam</td><td><input type='text' name='bestandd'></td></tr>
<tr><td><input type='reset' value='reset' NAME='reset'> </td><td><input type='submit' value='Send' name='submit'></td></tr>
</table>";
if(isset($_POST['top10insert']))
{
$insert = "INSERT INTO top10 ('naam', 'size', 'link', 'plek', 'bestandsnaam') VALUES ('".$_POST["naamm"]."', '".$_POST["sizee"]."', '".$_POST["linkk"]."', '".$_POST["plekk"]."', '".$_POST["bestandd"]."')";
mysql_query($insert) or die (mysql_error());
echo "Toegevoegd";
}
?>
<?
<form name='top10insert' action='index.php?inh=toevoegen' METHOD='POST'>
<table width='500' border='1' bordercolor='black' cellspacing='0'>
<tr><td>Plek: $obj->plek </td><td><input type='text' name='plekk'></td></tr>
<tr><td>Naam: $obj->naam </td><td><input type='text' name='naamm'></td></tr>
<tr><td>Link: $obj->link </td><td><input type='text' name='linkk'></td></tr>
<tr><td>Size: $obj->size </td><td><input type='text' name='sizee'></td></tr>
<tr><td>Bestand: $obj->bestandsnaam </td><td><input type='text' name='bestandd'></td></tr>
<tr><td><input type='reset' value='reset' NAME='reset'> </td><td><input type='submit' value='Send' name='submit'></td></tr>
</table>" ;
if ( isset ( $_POST [ 'top10insert' ] ) ) {
$insert = "INSERT INTO top10 ('naam', 'size', 'link', 'plek', 'bestandsnaam') VALUES ('" . $_POST [ "naamm" ] . "', '" . $_POST [ "sizee" ] . "', '" . $_POST [ "linkk" ] . "', '" . $_POST [ "plekk" ] . "', '" . $_POST [ "bestandd" ] . "')" ;
}
?>
simontjeuh - 19/06/2005 20:14 (laatste wijziging 19/06/2005 20:16)
HTML interesse
probeer dit eens:
<?
echo "
<form name='top10insert' action='index.php?inh=toevoegen' METHOD='POST'>
<table width='500' border='1' bordercolor='black' cellspacing='0'>
<tr><td>Plek: $obj->plek</td><td><input type='text' name='plekk'></td></tr>
<tr><td>Naam: $obj->naam</td><td><input type='text' name='naamm'></td></tr>
<tr><td>Link: $obj->link</td><td><input type='text' name='linkk'></td></tr>
<tr><td>Size: $obj->size</td><td><input type='text' name='sizee'></td></tr>
<tr><td>Bestand: $obj->bestandsnaam</td><td><input type='text' name='bestandd'></td></tr>
<tr><td><input type='reset' value='reset' NAME='reset'> </td><td><input type='submit' value='Send' name='submit'></td></tr>
</table>";
if(isset($_POST['submit']))
{
$insert = "INSERT INTO top10 ('naam', 'size', 'link', 'plek', 'bestandsnaam') VALUES ('".$_POST['naamm']."', '".$_POST['sizee']."', '".$_POST['linkk']."', '".$_POST['plekk']."', '".$_POST['bestandd']."')";
mysql_query($insert) or die (mysql_error());
echo "Toegevoegd";
}
?>
<?
<form name='top10insert' action='index.php?inh=toevoegen' METHOD='POST'>
<table width='500' border='1' bordercolor='black' cellspacing='0'>
<tr><td>Plek: $obj->plek </td><td><input type='text' name='plekk'></td></tr>
<tr><td>Naam: $obj->naam </td><td><input type='text' name='naamm'></td></tr>
<tr><td>Link: $obj->link </td><td><input type='text' name='linkk'></td></tr>
<tr><td>Size: $obj->size </td><td><input type='text' name='sizee'></td></tr>
<tr><td>Bestand: $obj->bestandsnaam </td><td><input type='text' name='bestandd'></td></tr>
<tr><td><input type='reset' value='reset' NAME='reset'> </td><td><input type='submit' value='Send' name='submit'></td></tr>
</table>" ;
if ( isset ( $_POST [ 'submit' ] ) ) {
$insert = "INSERT INTO top10 ('naam', 'size', 'link', 'plek', 'bestandsnaam') VALUES ('" . $_POST [ 'naamm' ] . "', '" . $_POST [ 'sizee' ] . "', '" . $_POST [ 'linkk' ] . "', '" . $_POST [ 'plekk' ] . "', '" . $_POST [ 'bestandd' ] . "')" ;
}
?>
gothmog - 20/06/2005 11:04
Lid
waarom moet dat met zo'n omweg?
het probleem is juist dat het niks doet, hij weergeeft zeg maar niet: 'Toegevoegd.'
dus hij weet de waardes wel, maar hij doet gewoon niks...
Legolas - 20/06/2005 11:17
Onbekend
Euh... waarom echoën jullie ZOVEEL html... wat heeft dat nou weer voor zin:s
<?php
require("databasebestand.php");
?>
<form name='top10insert' action='index.php?inh=toevoegen' METHOD='POST'>
<table width='500' border='1' bordercolor='black' cellspacing='0'>
<tr><td>Plek: <?= $obj->plek; ?></td><td><input type='text' name='plekk'></td></tr>
<tr><td>Naam: <?= $obj->naam; ?></td><td><input type='text' name='naamm'></td></tr>
<tr><td>Link: <?= $obj->link; ?></td><td><input type='text' name='linkk'></td></tr>
<tr><td>Size: <?= $obj->size; ?></td><td><input type='text' name='sizee'></td></tr>
<tr><td>Bestand: <?= $obj->bestandsnaam; ?></td><td><input type='text' name='bestandd'></td></tr>
<tr><td><input type='reset' value='reset' NAME='reset'> </td><td><input type='submit' value='Send' name='submit'></td></tr>
</table>
<?
if(isset($_POST['submit'])){
$insert = "INSERT INTO top10 ('naam', 'size', 'link', 'plek', 'bestandsnaam') VALUES ('".$_POST['naamm']."', '".$_POST['sizee']."', '".$_POST['linkk']."', '".$_POST['plekk']."', '".$_POST['bestandd']."')";
if(mysql_query($insert)) echo "Toegevoegd";
else die (mysql_error());
}
?>
<?php
require ( "databasebestand.php" ) ;
?>
<form name='top10insert' action='index.php?inh=toevoegen' METHOD='POST'>
<table width='500' border='1' bordercolor='black' cellspacing='0'>
<tr><td>Plek: <?= $obj -> plek ; ?> </td><td><input type='text' name='plekk'></td></tr>
<tr><td>Naam: <?= $obj -> naam ; ?> </td><td><input type='text' name='naamm'></td></tr>
<tr><td>Link: <?= $obj -> link ; ?> </td><td><input type='text' name='linkk'></td></tr>
<tr><td>Size: <?= $obj -> size ; ?> </td><td><input type='text' name='sizee'></td></tr>
<tr><td>Bestand: <?= $obj -> bestandsnaam ; ?> </td><td><input type='text' name='bestandd'></td></tr>
<tr><td><input type='reset' value='reset' NAME='reset'> </td><td><input type='submit' value='Send' name='submit'></td></tr>
</table>
<?
if ( isset ( $_POST [ 'submit' ] ) ) { $insert = "INSERT INTO top10 ('naam', 'size', 'link', 'plek', 'bestandsnaam') VALUES ('" . $_POST [ 'naamm' ] . "', '" . $_POST [ 'sizee' ] . "', '" . $_POST [ 'linkk' ] . "', '" . $_POST [ 'plekk' ] . "', '" . $_POST [ 'bestandd' ] . "')" ;
}
?>
Dit is beter, en moet werken...
gothmog - 20/06/2005 11:24
Lid
nu krijg ik dit:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''naam', 'size', 'link', 'plek', 'bestandsnaam') VALUES ('lkajlg
dat 'lkajlg' had ik gewoon als test ingevuld, ik had gwn mijn code bovenaan gebruikt, alleen dan: if(isset($_POST['top10insert'])){ naar > if(isset($_POST['submit'])){ veranderd...
Legolas - 20/06/2005 11:27 (laatste wijziging 20/06/2005 11:27)
Onbekend
Haal de quotes weg rond naam e.d.
dus zo:
$insert = "INSERT INTO top10 (naam, size, link, plek, bestandsnaam) VALUES ('".$_POST['naamm']."', '".$_POST['sizee']."', '".$_POST['linkk']."', '".$_POST['plekk']."', '".$_POST['bestandd']."')";
$insert = "INSERT INTO top10 (naam, size, link, plek, bestandsnaam) VALUES ('" . $_POST [ 'naamm' ] . "', '" . $_POST [ 'sizee' ] . "', '" . $_POST [ 'linkk' ] . "', '" . $_POST [ 'plekk' ] . "', '" . $_POST [ 'bestandd' ] . "')" ;
Gesponsorde links
Dit onderwerp is gesloten .