|
Posted by Luigi Donatello Asero on 07/24/05 17:40
"J.O. Aho" <user@example.net> skrev i meddelandet
news:3khldfFue9aoU1@individual.net...
> Luigi Donatello Asero wrote:
> > In the example below I have only written the html body to try to reduce
the
> > code to a minimum and find the error.
> >
> > <?php
> > if(isset($_POST['add']));
> > $fornamn = $_POST['fornamn'];
> > $efternamn = $_POST['efternamn'];
> > $db = mysql_connect("local host", "user",
> > "password");
> > mysql_select_db("scaiecat_?", $db);
> > $query = "INSERT INTO Formulr ('local host', 'user',
> > 'password');
>
> Avoid to use in table and column names, those leads usually to
problems.
Well, it might be that it leads to problems
But the table "semesterbostder" works on although I used ""
https://www.scaiecat-spa-gigi.com/sv/boende-i-italien.php
and https://www.scaiecat-spa-gigi.com/sv/test27.php
>
> > VALUES ('frnamn' ( '$fornamn'), efternamn('$efternamn')";
> > mysql_query($query) or die('Error, insert query failed'};
> > else {
>
> A query should look something like:
>
> $query="INSERT INTO Formular('fornamn','efternamn')
> VALUES($fornamn','$efternamn')";
Ok. I corrected it.
I also used echo to display the labels in the form
Unfortunately, I still get an error at
https://www.scaiecat-spa-gigi.com/sv/form.php
<?php
if(isset($_POST['add']));
$fornamn = $_POST['fornamn'];
$efternamn = $_POST['efternamn'];
$db = mysql_connect("local host", "user",
"password")
or die('I could not connect)};
mysql_select_db("scaiecat_?", $db);
$query="INSERT INTO Formular('fornamn','efternamn')
VALUES($fornamn','$efternamn')";
mysql_query($query) or die('Error, insert query failed')};
<html>
<body>
<form method="post">
<?php
echo
"<LABEL FOR="Fornamn">Frnamn</LABEL>";
<INPUT TYPE="TEXT" NAME="fnamn" id="Fornamn"><br>
echo
"<LABEL FOR="Efternamn">Efternamn</LABEL>";
?>
<INPUT TYPE="TEXT" NAME="efternamn" id="efternamn"><br>
<INPUT TYPE=SUBMIT VALUE=Skicka>
</FORM> </form>
</body>
</html>
?>
--
Luigi Donatello (un italiano che vive in Svezia)
https://www.scaiecat-spa-gigi.com/sv/italien-rom-trevi-due.php
[Back to original message]
|