如何在循环中获取价值并发送到另一个页面?

时间:2013-02-05 05:17:53

标签: php

我希望获得$sched->start_time$sched->end_time的值,并将其发送到next_page.php

<?php 
 foreach($foo as $row){
 echo "
 <tr>
   <td>".$sched->start_time."</td>
   <td>".$sched->end_time."</td>
   <td class='add'><a class='add_sched' href='next_page.php'>add new</a></td></tr>";
 }
?>

输出将如下所示


  

| 7:30 | 8:30 | *添加|
   | 8:30 | 9:30 | *添加|
   | 9:30 | 10:30 | *添加|

如果我点击*添加@ 8:30-9:30,该值将在next_page.php上发送 我应该怎么做?

1 个答案:

答案 0 :(得分:3)

试试这个......

echo
...

 "<td class='add'>
   <a class='add_sched' href='next_page.php?start_time=".$sched->start_time."&end_time=".$sched->end_time."'>add new</a>
</td>"

next.php

$start_time = $_GET['start_time'];
$end_time = $_GET['end_time'];