A
A
Anon33632020-04-27 14:05:22
PHP
Anon3363, 2020-04-27 14:05:22

GET Requests how to get a single user's message?

5ea6bbba38e79570509537.png

there is a message of users who go post method

<table class="table w-100" border="1">
    <thead class="thead-dark">
      <th>Sender Name</th>
      <th>Message</th>
      <th>Has been sent</th>
      <!--  			<th>Time</th> -->
    </thead>
    <?php foreach($mass as $item){ ?>
      <?php 
      $d = date_default_timezone_set("Asia/Yerevan"); 
 		$data = date("Y-m-d H:i:s"); //tvyal jamy
 		$data_obj = new DateTime($data); //tvyal jamy sargum en data obiekt
 		$str = $item["data_time"]; //uxarkvac namakneri jamayin tvyalner
 		$sended = new DateTime($str); //stanum enq uxarkvac namakneri datai obiekty
 		$interval = $data_obj ->diff($sended); //nranc tarberutyuny
 		$days = $interval->d;
 		$hours = $interval->h;
 		$minutes = $interval->i;
 		?>
 		<?php if($_SERVER["REQUEST_METHOD"] == "GET" && $_GET["name"] == $item["name"]){ ?>
 			<tbody>
 				<th><?=$item['name']?></th>
 				<th><?=$item['message']?></th>
 				<th><?="Sended ".$days." Days ".$hours." Hours ".$minutes." Minutes ago "?></th>
 			</tbody>
 		<?php } ?>
 			<tbody>
 				<th><?=$item['name']?></th>
 				<th><?=$item['message']?></th>
 				<th><?="Sended ".$days." Days ".$hours." Hours ".$minutes." Minutes ago "?></th>
 			</tbody>
 	<?php } ?>
 </table>


how to enter in the address bar for example admin.php?name=x and get the message of one user

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question