2011-01-13 53 views
0

你好我有一個會話的問題。當我使用會話將變量傳遞給另一個頁面時,該變量的值在其他頁面中始終保持不變。不管我選擇哪一行。當我將「動作」更改爲變量所在的同一頁面時,該值顯示正確。對不起,如果有人說西班牙語,我的英語不好,讓我知道解釋更好。我真的需要幫助。PHP和會話錯誤

這裏是我的代碼:

<?php 

include_once 'rnheader.php'; 

session_start(); 

$ticket_select = $_POST['serviceID']; 

echo '<a href = "rnservices.php"> Create Service</a> '; 

echo '<table border="1" >'; 

echo '<tr>'; 
echo '<th>Service ID</th>'; 
echo '<th>Title</th>'; 
echo '<th>Description</th>'; 
echo '<th>Notes</th>'; 
echo '<th>Submit By</th>'; 
echo '<th>Assigned Employee</th>'; 
echo '<th>Assigned Group</th>'; 
echo '<th>Category</th>'; 
echo '<th>Status</th>'; 
echo '<th>Urgency</th>'; 
echo '<th>Customer</th>'; 
echo '<th>Day Created</th>'; 
echo '</tr>'; 

$query = ("SELECT ServiceID, Title, Description, Notes, SubmitBy, AssignedEmp, " . 
"AssignedGroup, NameCategory, TipoStatus, TiposUrgencia, CustomerName, DayCreation FROM Service"); 
$result = queryMysql($query); 



while ($row = mysql_fetch_assoc($result)) { 

    echo '<tr>'; 

    echo '<td><form method ="post" action="rnservices1.php">'; 
    ?> 
    <input type="submit" name="serviceID" value=<?php echo $row['ServiceID']?> 
    <?php 
    echo '</form>'; 
    echo '<td>'.$row['Title'].'</td>'; 
    echo '<td>'.$row['Description'].'</td>'; 
    echo '<td>'.$row['Notes'].'</td>'; 
    echo '<td>'.$row['SubmitBy'].'</td>'; 
    echo '<td>'.$row['AssignedEmp'].'</td>'; 
    echo '<td>'.$row['AssignedGroup'].'</td>'; 
    echo '<td>'.$row['NameCategory'].'</td>'; 
    echo '<td>'.$row['TipoStatus'].'</td>'; 
    echo '<td>'.$row['TiposUrgencia'].'</td>'; 
    echo '<td>'.$row['CustomerName'].'</td>'; 
    echo '<td>'.$row['DayCreation'].'</td>'; 
    echo '</tr>'; 
} 

mysqli_free_result($result); 

echo $ticket_select; 
$_SESSION['serviceID'] = $ticket_select; 


'</table>'; 


?> 

回答

0

它是一個案件的問題?

$_SESSION['serviceID'] = $ticket_select; 
<input type="submit" name="serviceID" value=<?php echo $row['ServiceID']?> 
$ticket_select = $_POST['serviceID']; 

注意中間的一個在ServiceID上有一個大寫的S,另外兩個是serviceID。

+0

uery =「從服務中選擇標題,其中ServiceID ='$ ticket_select'」; $ result = queryMysql($ query); echo'行數:'。 mysql_num_rows($結果); ?> 」/>
<?php – maltad

+0

Value is當我使用echo $ ticket_select;但在創建變量的頁面中。當我在其他頁面中使用它時,變量的值不會更改。 – maltad

+0

你可以發佈其他網頁嗎? –