So heres the problem. the form works in three parts, all of the them
except for the last part where the mysql queries are ran.  The
variables of starting and ending number are not being sent.  i have
tried both methods of post and get with the second form and it still
will not work. i tried changing the variable in the for loop form $x
to $y and still nothing. the first for loop using the $_POST variables
works perfect. and i copied the code to the second for loop and
couldn't get it to function. Any one got any ideas as to why?
<?php
//DB connection code removed
if(!$submit and !$submit2)
{
?>
<form action = "<?php php_self; ?>" method="post">
<input type = "text" name = "startingnumber" value = "starting number" />
<input type = "text" name = "endingnumber" value = "num cards in set" />
<input type = "text" name = "cat" value = "set cat id" /> 
<input type = "submit" name = "submit" value = "submit">
</form>
<?php
}
elseif(!$submit2)
{
?>
<form action = "<?php php_self; ?>" method="get">
<?php 
echo $_POST['startingnumber'];
echo $_POST['endingnumber'];
for($X= $_POST['startingnumber']; $X<($_POST['startingnumber'] +
$_POST['endingnumber']); $X++)
        {
        echo $X;
        echo "<input type = \"text\" name =\"cardname[$X]\" value = \"card
name\">
<textarea name = \"cardtext[$X]\" cols = \"25\" rows = \"6\" >card
text</textarea>";
        print "hi</br></br></br>";
        }
?>
<input type = "submit" name = "submit2" value  = "submit" />
</form>
<?php
}
else
{
        //this is the place i add the code to add the cards to the database
        echo $_GET['startingnumber'];//not registering 
        echo $_GET['endingnumber'];//not registering
        $cat = $_POST['cat'];
                for($y=$_POST['startingnumber']; $y<($_POST['startingnumber'] +
$_POST['endingnumber']); $y++)
                {
                $card = $cardname[$x];
                $cardtext = addslashes($cardtext[$x]);
                mysql_query("INSERT INTO products VALUES($y, 0, 'single',
'$card.jpg', '0.0000', '2008-01-12 13:13:50', NULL, NULL, '0.00',
1,0,0,0)") or die("Fucked up somewhere:" . mysql_errno()  . ":" .
mysql_error());
                mysql_query("INSERT INTO products_description VALUES ($y, 1,
'$card', '$cardtext', '', 0)") or die("Fucked up somewhere2:" .
mysql_errno()  . ":" . mysql_error());
                mysql_query("INSERT INTO products_to_categories VALUES ($y, 
$cat)")
or die("fucked up somewhere3:" . mysql_errno()  . ":" . mysql_error());
                echo "hi!!";
                }
        echo "hi!";
}
?>

Reply via email to