rilana Posted February 29, 2008 Share Posted February 29, 2008 Hi everyone. I am trying to figure out something supposely easy and I cant get it working. Please help me. I do have a flash form and I am sending data via a php to an e-mail Adress. So far so good. That works. But now I am trying to write the info into a mysql database at the same time. I tryed setting it up with a html form and php to start. But I cant evan get that to work! My hosting Package only support PHP 5. Maby thats the Problme. But I dont have a clue. Please help. I realy would aprechiate to find out what I am doing wrong. This is my html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Unbenanntes Dokument</title> </head> <body> <html> <body> <form action="form.php" method="post"> from: <input type="text" name="from" /> Geschlecht: <input type="text" name="Geschlecht" /> Vorname: <input type="text" name="Vorname" /> Name: <input type="text" name="Name" /> Loesung: <input type="text" name="Loesung" /> Fahrzeug: <input type="text" name="Fahrzeug" /> Teilnahmebedingung: <input type="text" name="Teilnahmebedingung" /> <input type="submit" /> </form> </body> </html> </body> </html> And this my PHP <?php $link = mysql_connect('rilanab.mysql.db.internal', 'rilanab_rilana', 'rilana'); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('rilanab_form'); mysql_query("INSERT INTO person (from, Geschlecht, Vorname, Name, Loesung, Fahrzeug, Teilnahmebedingung) VALUES('$from', '$Geschlecht', '$Vorname', $Name', $Loesung', $Fahrzeug', $Teilnahmebedingung')"); ?> The connection to the database seems to be working. And this my database dump -- phpMyAdmin SQL Dump -- version 2.11.4 -- http://www.phpmyadmin.net -- -- Host: mysql02.db.hostpoint.internal -- Erstellungszeit: 29. Februar 2008 um 14:25 -- Server Version: 5.1.22 -- PHP-Version: 5.2.5 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Datenbank: `rilanab_form` -- -- -------------------------------------------------------- -- -- Tabellenstruktur für Tabelle `personnel` -- CREATE TABLE IF NOT EXISTS `personnel` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Vorname` varchar(25) COLLATE utf8_unicode_ci DEFAULT NULL, `Name` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `Geschlecht` varchar(12) COLLATE utf8_unicode_ci DEFAULT NULL, `from` varchar(35) COLLATE utf8_unicode_ci DEFAULT NULL, `Loesung` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `Fahrzeug` varchar(20) COLLATE utf8_unicode_ci NOT NULL, `Teilnahmebedingung` varchar(20) COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ; -- -- Daten für Tabelle `personnel` -- Please help. Thanks a lot! Quote Link to comment Share on other sites More sharing options...
Grant Holmes Posted February 29, 2008 Share Posted February 29, 2008 I would pull your private connection stuff out of your post. Too Much Information to have roaming around. Quote Link to comment Share on other sites More sharing options...
rilana Posted February 29, 2008 Author Share Posted February 29, 2008 I am using this table mostly for learning and I will change the infos later.... Please could someone help me? I am trying to figure this out for night and days going thrue several tutorials and I just dont get it... why doesn't it work? Quote Link to comment Share on other sites More sharing options...
revraz Posted February 29, 2008 Share Posted February 29, 2008 Change "INSERT INTO person to "INSERT INTO personnel Quote Link to comment Share on other sites More sharing options...
rilana Posted February 29, 2008 Author Share Posted February 29, 2008 yes I saw that mistake earlier, but it still want work... I evan found a easier tutorial which also doesnt work.... <?php //connecting $dbname = ""; $dbloc = ""; $dbuser = ""; $dbpass = ""; mysql_connect($dbloc, $dbuser, $dbpass) or die (mysql_error()); mysql_select_db($dbname) or die (mysql_error()); //end connecting $name = strip_tags($http_post_data['name2']); $msg = strip_tags($http_post_data['msg']); $insert_str = "INSERT INTO flashnphp(name, msg) VALUES('" . $name . "', '" . $msg . "')"; $mysql = mysql_query($insert_str); if($mysql){ echo "done"; } else { echo "error :" . mysql_error(); } ?> this one does create rows in the table, but only empty once. I checked all the spelling and it's all correct. Thanks for helping I realy aprechiate it! Quote Link to comment Share on other sites More sharing options...
revraz Posted February 29, 2008 Share Posted February 29, 2008 Probably because you are using examples from PHP 3. Your variables are probably empty. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.