Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]wyświetlanie id wybranego char
pajurpl
post
Post #1





Grupa: Zarejestrowani
Postów: 18
Pomógł: 0
Dołączył: 29.09.2014

Ostrzeżenie: (0%)
-----


Witam mam problem próbuję id wybranego charname wyświetlić w formularzu aby potem te id dodać do bazy danych
id próbuje wyświetlić za pomocą tego
  1. <?php echo $charname[1]=$characterID[1] ?>
lecz to wyświetla id innego charname patrzałem za pomocą $_POST ale też nie wyświetla

  1. <?php if ($_POST['buy']==false): ?>
  2. <?php
  3. $id=$_SESSION['username'];
  4. $query ="SELECT * FROM accounts,characters WHERE accounts.accountID=characters.ownerID AND username='$id'";
  5.  
  6. $result = mysql_query($query) or die(mysql_error());
  7. // Print out the contents of each row into a table
  8. echo "<select size=1 name=char_receiver>";
  9. while($row = mysql_fetch_array($result)){
  10. $charname[1] = $row['charname'];
  11. $characterID[1] = $row['CharacterID'];
  12. echo '<option>'.$charname[1].'</option>';
  13. }
  14. echo "</select>";
  15.  
  16.  
  17. ?>
  18.  
  19.  
  20. <form method='POST' action='2.php'>
  21. <table cellspacing="10">
  22. <tr>
  23. <td>ID</td><td>Stack ID</td><td>Nazwa</td><td>Cena</td><td></td>
  24. </tr>
  25. <tr>
  26. <td><?php echo $_POST['itemid']?><input type="hidden" name="item1" value="<?php echo $_POST['itemid']?>"/></td>
  27. <td><?php echo $_POST['itemstack_id']?><input type="hidden" name="stack1" value="<?php echo $_POST['itemstack_id']?>"/></td>
  28. <td><?php echo $_POST['name']?><input type="hidden" value="<?php echo $name ?>"/></td>
  29. <td><?php echo $_POST['cost']?><input type="hidden" value="<?php echo $cost ?>"/></td>
  30. <td><input type="hidden" name="char_receiver" value="<?php echo $charname[1]=$characterID[1] ?>"/></td>
  31. <td><input type='submit' name="buy" value='Kup'></td>
  32. </tr>
  33. </table>
  34.  
  35. </form>
  36. <?php endif; ?>


Ten post edytował pajurpl 1.10.2014, 19:54:59
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.10.2025 - 19:49