2016-04-23 110 views
0

谁能告诉我为什么我无法链接到main.php文件中的数据角色页面<div data-role="page" id="sessionrecordsuccess">?相反,当php文件执行时,它指向我的顶部main.php我有另一个php文件链接到另一个数据在同一个HTML文件中的作用非常好,我检查了任何语法错误,所以不知道为什么这个一个不是?问题链接php中的jquery移动数据角色页面

record_session.php

<?php 

$servername = ""; 
$username = ""; 
$password = ""; 

$con=mysqli_connect('','','',''); 
// This code creates a connection to the MySQL database in PHPMyAdmin named 'ibill': 

if (mysqli_connect_errno()) { 
    echo "Failed to connect to MySQL: " . mysqli_connect_error(); 
} 
// The connection is then checked, if it fails, an echo is sent back to the page stating a connection error. 

if(!empty($_POST)) 
{ 
    $typeofactivity = $_POST['typeofactivity']; 
    $employer = $_POST['employer']; 
    $date = $_POST['date']; 
    $time = $_POST['time']; 
    $amount = $_POST['amount']; 
    $errorMessage = ""; 

    if(empty($typeofactivity)) { 
     $errorMessage .= "<li>You forgot to enter an activity!</li>"; 
    } 
    if(empty($employer)) { 
     $errorMessage .= "<li>You forgot to enter an employer!</li>"; 
    } 
    if(empty($date)) { 
     $errorMessage .= "<li>You forgot to select the date!</li>"; 
    } 
    if(empty($time)) { 
     $errorMessage .= "<li>You forgot to select the time!</li>"; 
    } 
    if(empty($amount)) { 
     $errorMessage .= "<li>You forgot to select the amount of the session!</li>"; 
    } 

    $record_session = "INSERT INTO session_details (typeofactivity, employer, date, time, amount) VALUES ('$typeofactivity', '$employer', '$date', '$time', '$amount')"; 
    mysqli_query($con, $record_session); 
} 

/** Error reporting */ 
error_reporting(E_ALL); 
ini_set('display_errors', 1); 
ini_set('display_startup_errors', 1); 

header('Location: main.php#sessionrecordsuccess'); 
exit(); 
?> 

main.php#sessionrecordsuccess

<!--********************************RECORD SESSION PAGE SUCCESS************************************--> 
<!--***************************************************************************************--> 

<!--********************************HEADER**********************************************--> 
<div data-role="page" id="sessionrecordsuccess"> 
    <div data-role="header" data-id="foo1" data-position="fixed"> 
    <div class='cssmenu'> 
     <ul> 
     <li class='active'><a href='#home'>Home</a></li> 
     <li><a href='#sessionrecord'>Record a Session</a></li> 
     <li><a href='#viewsessions'>View Sessions</a></li> 
     <li><a href='#email'>E-mail an Invoice</a></li> 
     </ul> 
    </div> 
    </div><!-- /header --> 
<!--********************************HEADER**********************************************--> 

<!--********************************MAIN**********************************************--> 
    <div data-role="main" class="ui-content"> 

    <img class="mainlogo" src="/projects/ibill_v3/img/ibill logo.png" alt="iBill Logo" width="250" height="190"> 

     <section class="maincontent"> 
      <h1>Record a session using the form below</h1> 
      <P>Session logged successfully! <br>Record another...</p> 
      <form method="post" action="record_session.php" id="sessionRecord"> 
       <fieldset> 
        <select name="typeofactivity" id="typeofactivity" data-native-menu="false"> 
        <option>Type of Session</option> 
        <option value="Surf">Surf</option> 
        <option value="Coasteer">Coasteer</option> 
        <option value="Bodyboard">Bodyboard</option> 
        <option value="Cornish Challenge">Cornish Challenge</option> 
        </select> 
       </fieldset> 
       <fieldset> 
        <select name="employer" id="employer" data-native-menu="false"> 
        <option>Employer</option> 
        <option value="Newquay Activity Centre">Newquay Activity Centre</option> 
        <option value="Coastline Coasteer">Coastline Coasteer</option> 
        </select> 
       </fieldset> 
        <label for="date">Date of Session</label> 
        <input type="date" data-clear-btn="false" name="date" id="date" value=""> 

        <label for="time">Time of Session</label> 
        <input type="time" data-clear-btn="false" name="time" id="time" value="">     

        <label for="amount">Amount (GBP)</label> 
        <input type="number" data-clear-btn="true" name="amount" id="amount" value=""> 
       <div id="submitbutton"> 
        <input type="submit" name="formSubmit" value="Submit"> 
       </div> 
      </form> 

     </section> 
    </div> 
<!--********************************MAIN**********************************************--> 

<!--********************************FOOTER**********************************************--> 
    <div data-role="footer"> 
    <footer class="footer"> 
     <p>awilliams&copy;</p> 
    </footer> 
    </div> 
</div> 
<!--********************************FOOTER**********************************************--> 

<!--********************************END OF RECORD SESSION PAGE SUCCESS************************************--> 
<!--***************************************************************************************--> 

回答

0

我刚才设法弄清楚,但认为我会回答,以便其他人可以看到。我错过了表单标签中的data-ajax="false属性。