runnerjp Posted November 10, 2009 Share Posted November 10, 2009 ok im getting Undefined index on this line.. print_r($_REQUEST['form']); below is the full script its form <?php ini_set("display_errors", "1"); error_reporting(E_ALL); echo "<pre>"; echo "POST:"; print_r($_POST); echo "FILES:"; print_r($_FILES); echo "</pre>"; if ((($_FILES["file"]["type"] == "application/msword")) && ($_FILES["file"]["size"] < 500000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("entrys/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "entrys/" . $_FILES["file"]["name"]); echo "Stored in: " . "entrys/" . $_FILES["file"]["type"]; } } } else { echo "Invalid file".$_FILES["file"]; } print_r($_REQUEST['form']); ?> and here is my form why is it displaying this error?? <form action="/include/addfixture.php" method="post" onsubmit="return AIM.submit(this, {'onStart' : startCallback, 'onComplete' : completeCallback})"enctype="multipart/form-data"> <div><label>Name:</label> <input type="text" name="name" /></div> <div><label>File:</label> <input type="file" name="file" /></div> <div><input type="submit" name="form"value="SUBMIT" /></div> </form> Quote Link to comment Share on other sites More sharing options...
cags Posted November 10, 2009 Share Posted November 10, 2009 Because the first time you load the page the form hasn't been submitted, which means the $_REQUEST array is empty. Therefore when you try and echo out the 'form' element of the array, it doesn't exist, hence, undefined index. Quote Link to comment Share on other sites More sharing options...
darkvengance Posted November 10, 2009 Share Posted November 10, 2009 Hmm...I don't see it..but maybe that's because I just work up lol... Instead of using $_REQUEST['form'] why not use $_POST['form']? To me it just looks nicer. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.