如何从php里面的输入字段中获取信息

I have a form in which I have the following field : <input class="form-field" type="file" name="photo" />

how I can get the information from this field to be used in a if cycle in php ? if ($photo != '') {

It's in the $_FILES superglobal.

Incidentally, file uploads won't work unless

  1. the form method is POST,
  2. the form type is multipart/form-data.

You can find this info into the $_FILES superglobal.

Example:

$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

// your ($photo != '') is here
if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    ...
}

Source: http://www.tizag.com/phpT/fileupload.php

POST method uploads You can check this examples of how to works $_FILES, sorry for my bad english