Forum Moderators: coopster
I have 2 pages, one has a submission field with a bunch of variables in it and the other takes all this information and will make a few files and set things up for the script to easily read, the end result will kinda be a bulletin board using flat files, anyways this is the submission field:
echo "<div>";
echo "<form action='/submit.php' method='post' enctype='multipart/form-data'>";
// User Feilds
echo "<b>Game Name: </b> <input type='text' name='sub_name' size='50' /><br />";
echo "Game Image: <input name='sub_image' type='file' /> <br />";
echo "Number of Players: <select>";
echo "<option name='sub_players' value='unknown'>?</option>";
echo "<option name='sub_players' value='1'>1</option>";
echo "<option name='sub_players' value='2'>2</option>";
echo "<option name='sub_players' value='3'>3</option>";
echo "<option name='sub_players' value='4'>4</option>";
echo "<option name='sub_players' value='5'>5</option>";
echo "<option name='sub_players' value='6'>6</option>";
echo "<option name='sub_players' value='7'>7</option>";
echo "<option name='sub_players' value='8'>8</option>";
echo "</select> <br />";
echo "Release Date: <input type='text' name='sub_date' size='20' /><br />";
echo "Publisher: <input type='text' name='sub_publisher' size='30' /><br />";
echo "Genre: <select>";
echo "<option name='sub_genre' value='unknown'>?</option>";
echo "<option name='sub_genre' value='action'>Action</option>";
echo "<option name='sub_genre' value='casual'>Casual</option>";
echo "<option name='sub_genre' value='other'>Other</option>";
echo "<option name='sub_genre' value='poker'>Poker</option>";
echo "<option name='sub_genre' value='puzzle'>Puzzle</option>";
echo "<option name='sub_genre' value='racing'>Racing</option>";
echo "<option name='sub_genre' value='shooter'>Shooter</option>";
echo "<option name='sub_genre' value='sim'>Simulation</option>";
echo "</select> <br />";
echo "Online: <input type='checkbox' name='sub_online'/><br />";
echo "Mii Support: <input type='checkbox' name='sub_miisupport'/><br />";
echo "DLC: <input type='checkbox' name='sub_dlc'/><br />";
echo "Wii Points: <input type='text' name='sub_points' size='10' /><br />";
echo "ESRB Rating: <select>";
echo "<option name='sub_rating' value='unknown'>?</option>";
echo "<option name='sub_rating' value='ec'>Early Childhood</option>";
echo "<option name='sub_rating' value='e'>Everyone</option>";
echo "<option name='sub_rating' value='e10plus'>Everyone 10+</option>";
echo "<option name='sub_rating' value='t'>Teen</option>";
echo "<option name='sub_rating' value='m'>Mature</option>";
echo "<option name='sub_rating' value='ao'>Adults Only 18+</option>";
echo "</select> <br />";
echo "Description: <textarea rows='10' cols='45' name='sub_description'></textarea>";
// Hidden feilds
echo "<input type='hidden' name='sub_type' value='ware' /><br />";
// Submit Info
echo "<b>Bold</b> Feilds are required ";
echo " <input type='submit' value='Make Game' />";
echo "</form>";
echo "</div>";
<?php
// Get information from previous page/
echo '<pre><b>Getting information...</b><br />';
// Getting Game Name
$name = $_POST["sub_name"];
echo $_POST['1'];
echo "the name is $name yes it is<br />";
// Getting File Upload
if ((($_FILES["sub_image"]["type"] == "image/gif")
¦¦ ($_FILES["sub_image"]["type"] == "image/jpeg")
¦¦ ($_FILES["sub_image"]["type"] == "image/pjpeg"))
¦¦ ($_FILES["sub_image"]["type"] == "image/png")) {
if ($_FILES["sub_image"]["error"] > 0) {
echo "Error: " . $_FILES["sub_image"]["error"] . "<br />";
} else {
echo "Game Image Name: " . $_FILES["sub_image"]["name"] . "<br />";
echo "Game Image Type: " . $_FILES["sub_image"]["type"] . "<br />";
echo "Game Image Size: " . ($_FILES["sub_image"]["size"] / 1024) . " Kb<br />";
}
} else {
echo "Game Image File Type Invalid.<br />";
}?>
[edited by: eelixduppy at 4:52 am (utc) on Sep. 23, 2008]
[edit reason] no URLs, please [/edit]
I tried your code and it appears to work fine even without any modification, $_POST['sub_name'] shows correctly for me, also $_POST['sub_date'].
try this to get a list of all $_POST values to see if you are getting correct values on submit.php, if yes then it could be a duplicate variable name somewhere in your code, overwriting existing value.
this goes on top of your submit.php just to check,
echo "<pre>";
print_r($_POST);
echo "</pre>";
description
[sub_type] => ware
)
I don't even have a sub_date? and none of my drop down menus are working either, but that may be another problem I just noticed it and havent check into it yet