Pomoc - Szukaj - U¿ytkownicy - Kalendarz
Pe³na wersja: pobieranie subject z linku
Forum PHP.pl > Forum > Przedszkole
marmon
witam
chcialbym poprosic o wyjasnienie mi co nazlezy zmienic aby subject byl pobierany z linku

Kod
usercp.php?do=pm&action=edit&subject=TUTAJ JEST TYTU£&uid=2&what=new&to=user1


pozdrawiam


  1. <?php
  2. elseif ($do=="pm" && $action=="edit")
  3. {
  4. // if new pm will give id=0 and empty array
  5. if (isset($_GET['id']) && $_GET['id'])
  6. $id=intval(0+$_GET['id']);
  7. else $id=intval(0);
  8. if (!isset($_GET['what'])) $_GET['what'] = '';
  9. if (!isset($_GET['to'])) $_GET['to'] = '';
  10.  
  11. $res=mysql_query("select messages.*, users.username as sendername FROM messages INNER JOIN us
    ers on users.id=messages.sender WHERE receiver=$uid AND messages.id=$id"
    );
  12. block_begin(PRIVATE_MSG);
  13. if (!$res)
  14.  err_msg(ERROR,BAD_ID);
  15. else
  16. {
  17. print("n<form method=post name=edit action=usercp.php?do=$do&action=post&uid=$uid><table class="lista" width="100%" align="center" cellpadding="2">");
  18. $result=mysql_fetch_array($res);
  19. print("n<tr><td class=header>".RECEIVER.":</td><td class=header><input type="text" name="receiver" value="".($_GET["what"]!="new" ? unesc($result["sendername"]):urldecode($_GET["to"]))."" size="40" maxlength="40" ".($_GET["what"]!="new" ? " readonly" : "")." />&nbsp;&nbsp;".($_GET["what"]=="new" ? "<a href="javascript:popusers('searchusers.php');">".FIND_USER."</a>" : "")."</td></tr>");
  20. print("n<tr><td class=header>".SUBJECT.":</td><td class=header><input type="text" name="subject" value="".($_GET["what"]!="new" ? (strpos(unesc($result["subject"]), "Re:")===false?"Re:":"").unesc($result["subject"]):"")."" size="40" maxlength="40" /></td></tr>");
  21. print("n<tr><td colspan=2>".textbbcode("edit","msg",($_GET["what"]=="quote" ? "[quote=".htmlspecialchars($result["sendername"])."]".unesc($result["msg"])."[/quote]" : ""))."</td></tr>");
  22. print("n</table>");
  23. print("<br />");
  24. print("n<table class=lista width=100% align=center>");
  25. print("n<tr><td class=lista align=center><input type="submit" name="confirm" value="".FRM_CONFIRM."" /></td><td class=lista align=center><input type="submit" name="confirm" value="".FRM_CANCEL."" /></td></tr>");
  26. print("n</table></form>");
  27. }
  28.  
  29. ?>
nospor
zmienne z linku znajduj± sie w tablicy $_GET. subject wiec pobierasz:
  1. <?php
  2.  
  3. echo $_GET['subject'];
  4.  
  5. ?>

poczytaj se o $_GET i $_POST
To jest wersja lo-fi g³ównej zawarto¶ci. Aby zobaczyæ pe³n± wersjê z wiêksz± zawarto¶ci±, obrazkami i formatowaniem proszê kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.