Form to PHP Problems
My problem:
I have a form (admin/newa.php) and a script (admin/add.php). The form newa.php lets a user input several items and submit it to the database (add.php). But add.php does not recieve the form items (title,size,etc.).
Form Setup:
FORM: ACTION=add.php METHOD=post
INPUT: NAME=title TYPE=text
INPUT: NAME=artist TYPE=text
INPUT: NAME=anime TYPE=text
INPUT: NAME=size TYPE=text
TEXTAREA: NAME=review
INPUT: TYPE=submit
For the tracks you can choose the amount from a drop down menu at the top.
PHP Snippet:
<?php
if (isset($tracks4)) {
$numoftracks = $tracks0 + $tracks1 + $tracks2 + $tracks3 + $tracks4;
// the tracks# variables are from the drop down menus.
} else if (isset($tracks3)) {
$numoftracks = $tracks0 + $tracks1 + $tracks2 + $tracks3;
} else if (isset($tracks2)) {
$numoftracks = $tracks0 + $tracks1 + $tracks2;
} else if (isset($tracks1)) {
$numoftracks = $tracks0 + $tracks1;
} else if (isset($tracks0)) {
$numoftracks = $tracks0;
}
if (isset($fivedisc)) {
$numofdiscs = \"5\";
// The (number)disc variables are gotten from Checkboxes NEXT to the drop down menus.
} else if (isset($fourdisc)) {
$numofdiscs = \"4\";
} else if (isset($threedisc)) {
$numofdiscs = \"3\";
} else if (isset($twodisc)) {
$numofdiscs = \"2\";
} else if (isset($onedisc)) {
$numofdiscs = \"1\";
}
mysql_query(\"INSERT INTO ata_albums(id,numofdiscs,albumtitle,albumartist,albumsize,review,numoftracks) VALUES (NULL,'$numofdiscs','$title','$artist','$size','$review','$numoftracks')\");
if (isset($tracks0)) {
$i = 1;
while ($i <= $tracks0) {
mysql_query(\"INSERT INTO ata_tracks(id,discnum,albumtitle,albumartist,tracksize,tracktitle,,tracklocal,review,numoftracks) VALUES (NULL,'1','$title','$artist','$size[$i]','$track[$i]','$location[$i]','$i')\");
$i++;
}
} // This is only 1 of the 5 WHILE() blocks.
echo mysql_error();
echo \"<BR>\";
?>
[James Logsdon]
necrotic posted this at 04:59 — 28th September 2002.
He has: 296 posts
Joined: May 2002
Nevermind, I figured out what I did wrong.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.