NYCPHP Meetup

NYPHP.org

[nycphp-talk] need help with input type="file"

Daniel Convissor danielc at analysisandsolutions.com
Wed Dec 10 23:58:45 EST 2003


Hi Michael:

On Wed, Dec 10, 2003 at 06:18:19PM -0500, Michael Southwell wrote:

Nasir answered the question regarding where to find the file info.

Can I give you some style advice that will garner you better performance
and acceptance amongst the larger programming community?

* Put a space around the equals sign when doing assignments -- making it 
  more readable.

* Put single quotes around the array's keys -- averting PHP having to 
  waste time trying to find a constant named "name" that doesn't exist
  then having to guess that you mean't the string "name."

>   $name=$_POST[name];

    $name = $_POST['name'];

* Finally, don't waste code, execution time or memory by reassigning the 
  post variables.  Just use $_POST['name'] where you need it.  If you need
  to use it in a string, put {} around it like this
      echo "The submitted filename is {$_POST['name']}";
  or break it out like this
      echo 'The submitted filename ' . is {$_POST['name']};
  Take note of the single quotes vs the double quotes.

Enjoy,

--Dan

-- 
     FREE scripts that make web and database programming easier
           http://www.analysisandsolutions.com/software/
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7th Ave #4AJ, Brooklyn NY    v: 718-854-0335   f: 718-854-0409



More information about the talk mailing list