[英]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.