JeRRy wrote:
Okay here is the full code.  Now I got this code off a friend!  In this first 
section to display the data that is grabbed from the db.
----
  <?php
  $db = mysql_connect("localhost", "user", "pass");
  mysql_select_db("db_select",$db);
  $result = mysql_query("SELECT `nickname`  FROM tipping
WHERE 1
ORDER BY `score`
DESC LIMIT 0, 30",$db);
  while ($myrow = mysql_fetch_row($result)) {
                  printf("
<br><input type=text name=username[$a] value=%s> <br>",
                $myrow[0]);
  }
  ?>
  <input type="submit" value="submit">
</form>
</p>
----
It displays the data fine. Please note in the above there is more code and I doubt the issue is in there as the data fetching shows fine, I believe the error lies somewhere below. Than the form submit is pushed to another page with this code: --- <?
  include('../conf.inc.php');
      if ($REQUEST_METHOD == "POST") {
            $usr = "user";
            $pwd = "pass";
            $db = "db_select";
            $host = "localhost";
              $cid = mysql_connect($host,$usr,$pwd);
            mysql_select_db($db);
// NOTE that form fields automatically become variables


Re: this comment - they only do if you have register_globals turned on.

If you have it turned off (very very good idea!), you have to:

$username = $_POST['username']['$a']

Then you can use that in your query instead of $username[$a]

Note that the quotes are important - otherwise it will look for variable $a which doesn't exist (at least in this code).


I don't know why you have the input area named like this:

<input type=text name=username[$a]

but that's up to you (me, I'd just call it 'username').

Check register_globals with a phpinfo page.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to