Jump to content

shadowblade

Members
  • Content Count

    3
  • Joined

  • Last visited

Community Reputation

0 Neutral

About shadowblade

  • Rank
    Newbie

Contact Methods

  • AIM
    shadowblade668
  • Website URL
    http://ashafer.org
  • ICQ
    0

Profile Information

  • Location
    Kalamazoo, MI, US
  1. So right now I have a while loop generating a bunch of form fields, each with a number added by the loop in the name. (Some stuff removed for clarity/brevity) ex... $getData = mysql_query("SELECT * FROM table");$data = mysql_fetch_array($getData);$i = 0;while($data != null) { echo "<td><input type='text' name='pname$i' value='$name'></td><td><input type='text' name='pfile$i' value='$file'></td><td><input type='text' name='snum$i' maxlength='3' size='3' value='$show'></td></tr>"; $i++; } I need to have that data stored like so...$_POST['pname']['$i'];$_POST['pfile']['$i'];of course where $i is replaced with the appropriate number.Does anyone know a way to do this?
  2. Something that needs to be fixed right away...On the file upload section (http://w3schools.com/php/php_file_upload.asp) the file_exists() function is called, but the value passed to it is the user's file name, so with the given setup, the script will always stop because the file that the user selected to upload does in fact exist.This can be fixed like so... <?php$userfile = $_FILE['formfile']['name'];$name = basename($userfile);$dir = "some_upload_directory/";if (file_exists($dir.$name)) //code?> On that note, a few other things I'd like to see in the file upload section are a reference of MIME types for common files (and the fact that $_FILE["file"]["type"] is a MIME type and not just a common extension - afaik this isn't mentioned anywhere).Also, I don't think it is mentioned ever that the "file" in $_FILE["file"] is the name of the file field in the form. I can see this being very confusing for a beginner. It should be changed to something to differentiate it from the $_FILE array.
×
×
  • Create New...