0

我尝试了一些简单的代码来在我的表单中传递值,但它似乎没有发布。我可以知道问题出在哪里吗

@{

    if(IsPost)
    {            
        String Nric = Request.Form["nric"];
         //var db = Database.Open("StarterSite");
         //var user = db.QuerySingle("SELECT * FROM Patient WHERE NRIC = @0", Nric);
         var user = "test";
         user = null;
         if(user != null)
         {
            <script type="text/javascript">
                alert("Not a user!");
            </script>
         }
         else
         {
                   <script type="text/javascript">
       alert("Its a user!");
      </script>
         }


    }

    else
    {
           <script type="text/javascript">
       alert("Not a Post");
      </script>
    }    

}

<!DOCTYPE html>

<html lang="en">
    <head>
   <meta charset="utf-8" />
   <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Hospital Management System</title>
    <link href="../jquery/jquery.mobile-1.3.0.min.css" rel="stylesheet" type="text/css"/>
    <link href="../jquery/cmsmobile.css" rel="stylesheet" type="text/css"/>
    <script src="../jquery/jquery-1.9.js" type="text/javascript"></script>
    <script src="../jquery/jquery.mobile-1.3.0.min.js" type="text/javascript"></script>
    </head> 
<body> 

<div data-role="page" id="patmedirecmain">

    <div data-role="header" class="cms-header">
            <h1>
            Manage Medical Record
            </h1>
        @if (WebSecurity.IsAuthenticated) {
                            <text>
                                Hello, <a class="email" href="~/Account/Manage" title="Manage">@WebSecurity.CurrentUserName</a>!
                                <form id="logoutForm" action="~/Account/Logout" method="post">
                                    @AntiForgery.GetHtml()
                                    <a href="javascript:document.getElementById('logoutForm').submit()">Log out</a>
                                </form>
                            </text>
                        } else {
                            <ul>
                                <!--li><a href="~/Account/Register">Register</a></li-->
                                <li><a href="~/Account/Login">Log in</a></li>
                            </ul>
                        }
        <a href='index.php' data-role="button" data-iconpos="left" data-icon="back" data-theme="d" rel="external">Back</a>
        </div>

    <div data-role="content" class="cms-content">   
        <div class="ui-grid-a">


        <div class="ui-block-a">
        <ul data-role="listview" data-theme="e" class="list1">

                                <li><a href="doctor_info.cshtml">Personal Information</a></li>
                                <li><a href="doctor_schedule_daily.cshtml">Manage Appointment</a></li>
                                <li><a href="manage_medical_report.cshtml">Manage Medical Report</a></li>
                            </ul>
  </div>
               <div class="ui-block-d">
                   </div>

        <div class="ui-block-c">

        <br>
        <br>
           <form method="post">  <!--need to search database for a match of medirecord, form is used here-->
      <div data-role="fieldcontain">
                <label for="name">Patient NRIC:&nbsp</label>
                <input type="text" name="nric" id="nric" value=""  />
                </div>  
    <input value="Search" type="submit" data-role="button" data-theme="b" /><!--if cannot find display error msg else go to patient_hist.cshtml-->
             </form>
        </div>




</div>

    </div>
    <div data-role="footer" class="cms-footer">
        <p>HMS</p>
    </div>

</div>



</body>
</html>
4

0 回答 0