Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
试图将变量从两个表单元格传递到PHP文件,但$\u GET()会截断文本字符串_Php_Html - Fatal编程技术网

试图将变量从两个表单元格传递到PHP文件,但$\u GET()会截断文本字符串

试图将变量从两个表单元格传递到PHP文件,但$\u GET()会截断文本字符串,php,html,Php,Html,我已经从MySQL表创建了一个表。 每行有五列,第五列包含指向新php文件的超链接。新的php文件需要第3列和第4列中包含的变量。 我填充表格单元格的代码如下: <form method="GET" action="Web_Match_Sheet.php"> <table cellspacing="0" cellpadding="0" border="0" width="960"> <tr> <td> <table

我已经从MySQL表创建了一个表。 每行有五列,第五列包含指向新php文件的超链接。新的php文件需要第3列和第4列中包含的变量。 我填充表格单元格的代码如下:

<form method="GET" action="Web_Match_Sheet.php">

<table cellspacing="0" cellpadding="0" border="0" width="960">
  <tr>
    <td>
       <table cellspacing="0" cellpadding="1" border="1" width="935" >
         <tr>
            <th style="width: 187px;">Date</th>
            <th style="width: 187px;">First Tee Time</th>
            <th style="width: 187px;">Opponents</th>
            <th style="width: 187px;">Venue</th>
            <th style="width: 187px;"></th> 
         </tr>
       </table>
    </td>
  </tr>
  <tr>
    <td>
       <div style="width:960px; height:600px; overflow:auto;">
         <table cellspacing="0" cellpadding="1" border="1" width="935" >
           <?php while($row = mysqli_fetch_array($result)):;?>
            <tr>
                <td style="width: 187px;"><?php echo date('jS F, Y', strtotime($row[0]));?></td>
                <td style="width: 187px;">@&nbsp;<?php echo substr($row[1],0,5);?></td>
                <td style="width: 187px;"><?php echo $row[2];?></td>
                <td style="width: 187px;"><?php echo $row[3];?></td>
                <td style="width: 187px;"><a href="edit.php?Opponents=<?php echo $row[2];?> & Venue=<?php echo $row[3];?>">Team Sheet/Results</a></td>
            </tr>
            <?php endwhile;?>
         </table>  
       </div>
    </td>
  </tr>
</table>
</form>
<?php
session_start();
$uOpponentName = $_GET['Opponents'];
$_SESSION["Opponents"] = $uOpponentName;
$uVenue = $_GET['Venue'];
$_SESSION["Venue"] = $uVenue;
header('Location: Web_match_Sheet.php');
?>

日期
第一次发球
对手
地点
@ 
线路

<td style="width: 187px;"><a href="edit.php?Opponents=<?php echo $row[2];?> & Venue=<?php echo $row[3];?>">Team Sheet/Results</a></td>

调用php文件edit.php,并传递两个变量“accounters”和“vention”

edit.php文件如下所示

<form method="GET" action="Web_Match_Sheet.php">

<table cellspacing="0" cellpadding="0" border="0" width="960">
  <tr>
    <td>
       <table cellspacing="0" cellpadding="1" border="1" width="935" >
         <tr>
            <th style="width: 187px;">Date</th>
            <th style="width: 187px;">First Tee Time</th>
            <th style="width: 187px;">Opponents</th>
            <th style="width: 187px;">Venue</th>
            <th style="width: 187px;"></th> 
         </tr>
       </table>
    </td>
  </tr>
  <tr>
    <td>
       <div style="width:960px; height:600px; overflow:auto;">
         <table cellspacing="0" cellpadding="1" border="1" width="935" >
           <?php while($row = mysqli_fetch_array($result)):;?>
            <tr>
                <td style="width: 187px;"><?php echo date('jS F, Y', strtotime($row[0]));?></td>
                <td style="width: 187px;">@&nbsp;<?php echo substr($row[1],0,5);?></td>
                <td style="width: 187px;"><?php echo $row[2];?></td>
                <td style="width: 187px;"><?php echo $row[3];?></td>
                <td style="width: 187px;"><a href="edit.php?Opponents=<?php echo $row[2];?> & Venue=<?php echo $row[3];?>">Team Sheet/Results</a></td>
            </tr>
            <?php endwhile;?>
         </table>  
       </div>
    </td>
  </tr>
</table>
</form>
<?php
session_start();
$uOpponentName = $_GET['Opponents'];
$_SESSION["Opponents"] = $uOpponentName;
$uVenue = $_GET['Venue'];
$_SESSION["Venue"] = $uVenue;
header('Location: Web_match_Sheet.php');
?>

除了$\u GET()截断变量之外,所有这些都可以正常工作。 i、 布里斯托尔市成为布里斯托尔 我尝试了很多改变,但都失败了。 谁能给我指点解决办法吗。
这方面有点新手

在将值放入链接地址之前,尝试对该值执行
urlencode()


urlencode($row[2])
(或引起问题的任何一个。)

在将值放入链接地址之前,尝试对该值执行
urlencode()


urlencode($row[2])(或导致问题的任何一个。)

您的查询字符串需要做一些工作。不应该有不属于值的空格,值中的任何空格都应该正确编码。(它们应该在URL中显示为
+

PHP有一个内置函数,可以帮助您生成这样一个正确的查询字符串

$query = http_build_query(['Opponents' => $row[2], 'Venue' => $row[3]]);
然后可以将该查询字符串附加到URL

<a href="edit.php?<?= $query ?>">test<a>

您的查询字符串需要一些工作。不应该有不属于值的空格,值中的任何空格都应该正确编码。(它们应该在URL中显示为
+

PHP有一个内置函数,可以帮助您生成这样一个正确的查询字符串

$query = http_build_query(['Opponents' => $row[2], 'Venue' => $row[3]]);
然后可以将该查询字符串附加到URL

<a href="edit.php?<?= $query ?>">test<a>