Forum Moderators: coopster
Apache version : Apache/1.3.33 (Win32) JRun/4.0
PHP version : 5.0.4
MySQL version : 4.1.10a-nt - extension : mysqli
here is my rsvp.php
<?
$fname= $_POST[’fname’];
$lname= $_POST[’lname’];
$number=$_POST[’number’];
$emailaddy=$_POST[’email’];
echo "The following information will be entered into the database<br><br><br>";
echo "<b>FirstName:</b> $_POST[fname]<br>";
echo "<b>LastName:</b> $_POST[lname]<br>";
echo "<b># of Guests</b> $_POST[number]<br>";
echo "<b>Email:</b> $_POST[email]<br>";
echo "Thanks for taking the time to submit your information.";
if(isset($_POST['submit']))
{
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("wedding") or die(mysql_error());
mysql_query("INSERT INTO `rsvp` (`FirstName`, `LastName`, `Guests`, `emailaddy`) values ('$fname', ‘$lname','$number','$email')");
die(mysql_error());
echo "The following information was entered into the database<br><br><br>";
echo "<b>FirstName:</b> $_POST[’fname’]<br>";
echo "<b>LastName:</b> $_POST[lname’]<br>";
echo "<b># of Guests</b> $_POST[number]<br><br><br>";
echo "<b>Email:</b> $_POST[email]<br>";
echo "Thanks for taking the time to submit your information.";
mysql_close();
} else {
echo "Do not try to visit this page directly. Please use the <a href=form1.php>forms</a>";
}
?>
I know this maybe more than enough information or not enough information but any insight maybe helpful. Thanks in advance.
[edited by: eelixduppy at 1:37 pm (utc) on Oct. 17, 2007]
[edit reason] removed excess html [/edit]
$fname= $_POST['fname'];
$lname= $_POST['lname'];
$number=$_POST['number'];
$emailaddy=$_POST['email'];
echo "The following information will be entered into the database<br><br><br>";
echo "<b>FirstName:</b> ". $_POST['fname'] ."<br>";
echo "<b>LastName:</b> ". $_POST['lname'] ."<br>";
echo "<b># of Guests</b> ". $_POST['number'] ."<br>";
echo "<b>Email:</b> ". $_POST['email'] ."<br>";
echo "Thanks for taking the time to submit your information.";
mysql_query("INSERT INTO rsvp ( FirstName, LastName, Guests, emailaddy ) values ( '".$fname."', '".$lname."', '".$number."', '".$email."' )");
I'm not sure about the spacings there, but that's the way I do it. So, try emitting the single quotes from the table and cell names and encase the php-variables with double quotes and dots.
Hope this helps some.
[edited by: jatar_k at 12:24 pm (utc) on Oct. 19, 2007]
[edit reason] fixed sidescroll [/edit]
<?php
$link = mysql_connect("localhost", "root", "");
mysql_select_db("db_name", $link);
echo mysql_errno($link) . ": " . mysql_error($link). "\n";
mysql_query("INSERT ..", $link);
echo mysql_errno($link) . ": " . mysql_error($link) . "\n";
?>
Edit it for your need!