i teraz w którym miejscu by to dobrze umieścić i jak by to miało wyglądać
market.php
<?php //nr1 ?> <?php $id=$_SESSION['username']; { $mhpoints=$row3['mhpoints']; } ?> <table border="0" align="center" cellpadding="0"> <tr> <td>M.H Coins:</td> </tr> </table> <?php $serwer_bazy = "localhost"; $login_bazy = "root"; $haslo_bazy = "password"; $nazwa_bazy = "market"; /* jeżeli wynik jest pozytywny, to wyświetlamy dane */ $itemid = $r['itemid']; $name = $r['name']; $picturepath = $r['picturepath']; $description = $r['description']; $cost = $r['cost']; $itemstack_id = $r['itemstack_id']; echo "<form method='POST' action='market_step_buy.php'> <table cellspacing='20' align='center'> <tr > <td><input type='hidden' name='itemid' value='".$itemid." '/> <input type='hidden' name='itemstack_id' value='".$itemstack_id."'/></td> <td width='250'><img src='".$picturepath."' /><br /> <b>".$name."</b><input type='hidden' value='".$name." '/><br /> ".$description."<input type='hidden' value='".$description."'/></td> <td>".$cost."<input type='hidden' value='".$cost."'/> <img src='image/coins.png' width='18' height='13' /></td> <td><input type='image' src='image/buy.png'></td> </tr> </table> </form>"; } ?> <? } else { }; ?>
market_step_buy.php
<?php //nr1 ?> <?php if ($_POST['buy']==false): ?> <?php $id=$_SESSION['username']; $query ="SELECT * FROM accounts,characters WHERE accounts.accountID=characters.ownerID AND username='$id'"; // Print out the contents of each row into a table $charname[1] = $row['charname']; $characterID[1] = $row['CharacterID']; } ?> <form method='POST' action='market_step_buy.php' > <table cellspacing="10" align="center"> <tr> </tr> <tr> <td>Wpisz ID Postaci:</td> </tr> <tr> <td><input type="text" name="char_receiver" value="" onkeyup="this.value=this.value.replace(/\D/g,'')"/></td> </tr> <tr> <td><p class="info">*Wpisz powyżej ID postaci na, która ma być wysłany przedmiot np. 2)<br />*ID znajduje się w liście powyżej.</p></td> </tr> </table> <table> <tr align="center"> <td><input type='submit' name="buy" value='Kup'></td> </tr> </table> </form> <?php endif; ?> <?php { // odbieramy dane z formularza $item1 = $_POST['item1']; // ID Wysyłanego Itemu $stack1 = $_POST['stack1']; //Przedmiot w 1 Slocie Delivery $item2 = "0"; //ID 2 Itemu w Delivery $stack2 = "0"; //Slot numer 2 w Delivery $item3 = "0"; //ID 3 Itemu w Delivery $stack3 = "0"; //Slot numer 3 w Delivery $item4 = "0"; //ID 4 Itemu w Delivery $stack4 = "0"; //Slot numer 4 w Delivery $item5 = "0";//ID 5 Itemu w Delivery $stack5 = "0"; //Slot numer 5 w Delivery $charid_SENDER = '2'; // ID Postaci z której jest wysyłany Przedmiot $name_SENDER = 'Heroes Sklep'; //Nazwa Wiadomości u postaci z której była wysłany item $charid_RECEIVER = $_POST['char_receiver']; // ID Postaci, która ma dostać przedmiot $name_RECEIVER = 'Przedmiot z PD Sklepu'; //Nazwa Wiadomości którą dostanie postac z itemem $gold_REQUIRED = '0'; //Ilość wymaganego golda do odebrania wiadomości/itemu if($item1 and $stack1) { // łączymy się z bazą danych // dodajemy rekord do bazy $ins = @mysql_query("INSERT INTO mailbox SET item1='$item1', stack1='$stack1', charid_SENDER='$charid_SENDER', name_SENDER='$name_SENDER', charid_RECEIVER='$charid_RECEIVER', name_RECEIVER='$name_RECEIVER', gold_REQUIRED='$gold_REQUIRED', item2='$item2', stack2='$stack2', item3='$item3', stack3='$stack3', item4='$item4', stack4='$stack4', item5='$item5', stack5='$stack5'"); } } ?> <? } else { }; ?>