Jump to content

Michael_

Member
  • Posts

    9
  • Joined

  • Last visited

Posts posted by Michael_

  1. No, you will just echo the same thing $n times. Take a look at this

     

    <?php
    // display the number of input rows for invites. 
    for ( $c=0, $c<$n, $c++) {
    echo "
    
    
    \n";
    } 
    ?>
    

     

    View your html source to see the generated code.

    You will have name='whole_name[0]'

    Also, I removed id= because unless you're doing stuff with client side java script you don't need it, and if you do it must be a unique value (to be valid html) so you'd have to append $c to the id value

  2. Do you get values displayed for Sent: Sixe: and Type:

     

    also see the use of basename and move_uploaded_file

     

    if (move_uploaded_file( $_FILES['file']['tmp_name'],  "/usr/local/zend/apache2/htdocs/" . basename($_FILES['file']['name']) ) 
       echo "File is valid, and was successfully uploaded.\n";
    else 
       echo "File upload failed!\n";
    

  3. close, just added brackets [] is used for checkboxes, because you have text fields you shoud include an index inside the brackets.

     

    //assuming you have a for loop like
    for ($row=0; $row<5; $row++)
    {
     echo "... name=\"whole_name[$row]\" ...";
    }
    
    // fyi html also likes single quotes, this just looks cleaner
    
     echo "... name='whole_name[$row]' ...";
    
    // it will return
    
    $_POST['whole_name'][0]
    

  4. I think it's because you don't have quotes around the data fields in the sql statement. Using ',' may seem like you have the quotes, but that only creates a comma, you have to have "','"

     

    function newSchool()
    {
      $sql_command = "INSERT INTO schools (school, country, city, state, zip) VALUES ('" . $this->school . "','" . $this->country . "','" . $this->city . "','" . $this->state . "','" . $this->zip . "')";
    // by placing this in a variable you can test with
     echo $sql_command;
    
     $sql = mysql_query ($sql_command);
     return $sql; 
    }
    

×
×
  • Create New...