I'm newbie to PHP and learning things on my own. Anyways i have a project to finish by tomorrow and it's really not going well. I can try to simplify this as much as possible so u guys understand.
Introduction:
Reservation form online. so say we have a reservation.inc that includes the form and it has 1 field at this point cause if I figure out the problem with one of them, the rest is ok. 2- there is also login2.php that recieves data, checked if its ok, if so, writes into a database.
<form action="Login2.php?do=new" method="post" >
<table border="0" width="420">
<?PHP
if (isset($message_new))
echo "<tr><td colspan='2'><b>$message_new</b>
</td></tr>";
?>
<tr>
<td class="subtitleb">* <span class="text">Arrival date:</span>
<input type="text" name="nnights" size="10" maxlength="4" value="<?php echo @$ndyear ?>">
As u see the name is nnights.
2- Login page
<?php
session_start();
include("info.inc");
switch (@$_GET['do'])
{
case "new":
foreach($_POST as $field => $value)
/* the code in the middle here is not important right now because its just checking against pattern */
/* My problem starts here */
$yearstring = '$ndyear';
$monthstring = '$ndmonth';
$daystring ='$ndday';
$newdate = $yearstring.$monthstring.$daystring;
$sql = "INSERT INTO reservations (numNites)
VALUES ( '$nnights')";
mysql_query($sql);
Notice: Undefined variable: nnights in C:\Program Files\Apache Group\Apache2\htdocs\Pelagos\Login2.php
and I get this same problem with every other variable. But I know infact they are pass along because when I test the Pattern check section it works like a charm.
Oh and
default:
include("reservations.inc");
is included in the bttm
Can someone PLZ help me out. I really need to finish this project. I'd GREATLY appriciate some help