Jump to content
Larry Ullman's Book Forums

karenk

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by karenk

  1. Hi

    I am trying to use a For statement to create multiple input boxes:

    <?php for ($i = 1; $i <= $x; $i++);?><post Form><input class-"text-primary" type="text" class="form-control" name="username<?php$i;?>" maxle    ngth="40" id="usernameField" placeholder="Your Username" />

    <submit type button>
    And then retreiv the results using POST

    if ($_SERVER['REQUEST_METHOD'] == 'POST'){        $trimmed = array_map('trim', $_POST);        for ($j = 1; $j < $attendeeNO; $j++){        // Check for a username:        if (preg_match ('/^\w{4,20}$/', $trimmed["username$j"])) {                $un = mysqli_real_escape_string ($dbc, $trimmed["username$j"]);        } else {                echo '<p class="error">Please enter username' .$j. '!</p>';        }}}

    However, I cannot seem to retreive the HTML form input boxes and mainpulate them with the $_POST array.

     

    The error is that the index is undefined?

     

    The problem is that the index is not correctly being passed to the post array upon submission. I have been trying various forms of quotation for the submission but am wondering if I am correctly retrieving / looping through the $_POST form upon submission.

    Any thoughts?

     

    Thanks,
    Karen

     

  2. Hi

     

    When attempting to open this file and get a quote (KO) coca cola, NYSE

     

    I get the following error: (Please note that this file is directly from the downloads)

     

    Have I done something wrong?

     

    Tx :)

    Karen

     

    Warning: fopen(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/php_advanced/ch10/get_quote.php on line 18

    Warning: fopen(http://quote.yahoo.com/d/quotes.csv?s=KO&f=nl1): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/php_advanced/ch10/get_quote.php on line 18

    Warning: fgetcsv() expects parameter 1 to be resource, boolean given in /var/www/html/php_advanced/ch10/get_quote.php on line 21

    Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/html/php_advanced/ch10/get_quote.php on line 24

    The latest value for (KO) is $.
    Enter a NYSE stock symbol to get the latest price:

     

     

×
×
  • Create New...