简体   繁体   English

从数据库中获取的数据存储在文本字段中时,如何自动移动下一页

[英]how to automatically move next page when data fetched from database is stored in text field

I have php page where i have text field where I enter a number . 我有php页面,我在其中输入数字的文本字段。 The data are stored in database. 数据存储在数据库中。 I need to fetch the number entered in the text field to be automatically displayed in the next page and it as to disble where the user cannot modify it. 我需要获取在文本字段中输入的数字,以便在下一页中自动显示该数字,以解决用户无法对其进行修改的地方。 please suggest how can i do this using php, jquery. 请建议我如何使用php,jquery做到这一点。 Pls tel me how can i do it.. And the values entered in the second page as to go and fit in the database to the the number which i have entered in the first page. 请告诉我我该怎么做。然后在第二页中输入的值将适合我在第一页中输入的数字,并放入数据库中。

//first page
<table border="0" style="border-collapse:collapse;" align="center">
<tr>
<td>
<div id="col1" align="center"><br />
 <form method="post" action="user.php">
<label type="text" name="name" maxlength="50" size="30" class="label">Enter the Membership Number</label><br />
<input type="text" name='id' placeholder="enter Membership Number" class="input" size="40"/><br />
<span class="field">(* Required field)</span><br /><br />
<input type="submit" name="submit" value="SUBMIT" class="button"><br /><br /><br /><br />
</form>
</body>
</html>

<?php
mysql_connect("localhost","root","");
mysql_select_db("anthonys");
if(isset($_POST['submit']))
{
$id= $_POST['id'];
if( ! ctype_alnum($id) )
  die('invalid id');


$query = "SELECT uid FROM `payment` WHERE `uid` =$id";


$run = mysql_query($query);

echo $id;
if(mysql_num_rows($run)>0){

echo "<script>window.open('member1.php','_self')</script>";

}
else {

    echo "<script>alert('Login details are incorrect!')</script>";
    }
}
?>

//second page

$(function() {
        $("#XISubmit").click(function(){

   var uid=document.forms["XIForm"]["uid"].value;
        var fathername = document.forms["XIForm"]["fathername"].value;


        if(fathername == null || fathername == "")
    {
        alert("Please Enter  Father's Name");
        return false;
    }

    document.getElementById("XIForm").submit();

        }); 
            if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
            $('li').has('ul').mouseover(function() {
                $(this).children('ul').show();
            }).mouseout(function() {
                $(this).children('ul').hide();
            })
        }
;
    }); 

</script></head>



<section id="sheet"  style="background-color: Transparent;">

<div id="content_inner">


<header id="header_inner">St. Anthony's Parish Education Fund
<br /><b style="font-size:15px;">Bangalore 560 095</b><br /><img src="images/line1.jpg" alt="" /></header>



<div id="col2">
<h2>Application for the Membership</h2><br /><br />
<table border="0px" style="border-collapse:collapse; width:810px;" align="center">
<tr>
<td>
<form name="XIForm" id="XIForm" method="POST" action="pdf/pdf1.php">
<input type="text" name="uid" />
<label type="text" name="fathername" maxlength="50" size="30" class="label">Father's Name</label><br />
<input  name="fathername" placeholder="" class="input" size="40"/><br /><br />







    <input type="hidden" name="formType" id="formType" value="reg"/>
        <input type="button" name="XISubmit" id="XISubmit" value="ADD" class="button" />        


<br /><br /><br /><br />
</form></td>

This code doesnt fetch the value from the first page. 此代码不会从第一页获取值。

Pass the number through the url like 像这样通过url传递数字

if(mysql_num_rows($run)>0){
echo "<script>window.open('member1.php?id=".$id."','_self')</script>";
}

and in the page where you want to display this value, do the following: 在要显示此值的页面中,执行以下操作:

1) Accept the id from url with 1)接受url中的ID

if(isset($_GET['id'])
 $id=$_GET['id'];

2) Display the value in the textbox. 2)在文本框中显示值。

<input type="text" name="id" id="id" value="<?php if(isset($_GET['id']) { echo $id; } ?>"  readonly>

3) You can add this textbox in the form along with other form elements and can pass this id through the form as usual. 3)您可以将此文本框与其他表单元素一起添加到表单中,并且可以像往常一样通过表单传递此ID。

<form action="youractionpage.php" method="post">
ID <input type="text" name="id" id="id" value="<?php if(isset($_GET['id'])) { echo $id; } ?>"  readonly>
Amount <input type="text" name="amount">
Name  <input tpye="text" name="name">
<input type="submit" value="Submit">
</form>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Php隐藏字段如何从从数据库中获取的数据转发到下一页 - Php Hidden FIeld how to forward to next page from fetched data from database 如何打印存储在多维数组中并使用PHP从数据库中获取的数据? - how to print data stored in multidimensional array and fetched from database using PHP? PHP / MYSQL-如何将从数据库(存储在变量中)获取的数据分配给会话变量? - PHP/MYSQL - How do i assign data fetched from the database(stored in variables) to a session variable? 没有从数据库中获取数据 - Data is not fetched from database 如何使 select 选项从 ci 3 中的数据库中获取并在文本字段中自动填充结果? - How to make select option fetched from database in ci 3 and autofill result in text field? 如何以表格形式显示从数据库中获取的数据 - How to display the data fetched from the database in the form 如何将CSS应用于从数据库中获取的数据 - how to apply css for the data fetched from the database PHP&Ajax,Javascript-如何在将数据而不是文本提取到数据库中时显示模式 - PHP & Ajax , Javascript - How to display modal when data is fetched into the database instead of text 从数据库中选择名称后,如何自动填写输入字段? - How to fill input field automatically when name is selected from database? 使用 while 循环创建文本字段时,如何将多个文本字段值发送到下一个 pho 页面? - How to send multiple text field values to next pho page when the text field is created using while loop?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM