我只用了一个月编码,用php编写了不到3天。感谢您对我的任何帮助。
<?PHP
require_once("session.php");
require_once("./include/membersite_config.php");
if(isset($_POST['submitted']))
{
if($fgmembersite->RegisterUser())
{
$fgmembersite->RedirectToURL("thank-you.html");
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<title>Contact us</title>
<link rel="STYLESHEET" type="text/css" href="style/fg_membersite.css" />
<script type='text/javascript' src='scripts/gen_validatorv31.js'></script>
<link rel="STYLESHEET" type="text/css" href="style/pwdwidget.css" />
<script src="scripts/pwdwidget.js" type="text/javascript"></script>
</head>
<body>
<!-- Form Code Start -->
<div id='fg_membersite'>
<!-- I believe the problem is right in here. -->
<form action="session.php" method="post">
<form id='register' action='<?php echo $fgmembersite->GetSelfScript(); ?>' method='post' accept-charset='UTF-8'>
</form>
<fieldset >
<legend>Register</legend>
<input type='hidden' name='submitted' id='submitted' value='1'/>
<div class='short_explanation'>* required fields</div>
<input type='text' class='spmhidip' name='<?php echo $fgmembersite->GetSpamTrapInputName(); ?>' />
<div><span class='error'><?php echo $fgmembersite->GetErrorMessage(); ?></span></div>
<div class='container'>
<label for='name' >Your Full Name*: </label><br/>
<input type='text' name='name' id='name' value='<?php echo $fgmembersite->SafeDisplay('name') ?>' maxlength="50" /><br/>
<span id='register_name_errorloc' class='error'></span>
</div>
<FORM name ="form1" method ="post" action ="radioButton.php">
<Input type = 'Radio' Name ='gender' value= 'male' required value="1"
<?PHP print $male_status; ?>
>male
<Input type = 'Radio' Name ='gender' value= 'female' required value="2"
<?PHP print $female_status; ?>
>female
<P>
</FORM>
<div class='container'>
<label for='email' >Email Address*:</label><br/>
<input type='text' name='email' id='email' value='<?php echo $fgmembersite->SafeDisplay('email') ?>' maxlength="50" /><br/>
<span id='register_email_errorloc' class='error'></span>
</div>
<div class='container'>
<label for='username' >UserName*:</label><br/>
<input type='text' name='username' id='username' value='<?php echo $fgmembersite->SafeDisplay('username') ?>' maxlength="50" /><br/>
<span id='register_username_errorloc' class='error'></span>
</div>
<div class='container' style='height:80px;'>
<label for='password' >Password*:</label><br/>
<div class='pwdwidgetdiv' id='thepwddiv' ></div>
<noscript>
<input type='password' name='password' id='password' maxlength="50" />
</noscript>
<div id='register_password_errorloc' class='error' style='clear:both'></div>
</div>
<div class='container'>
<input type='submit' name='Submit' value='Submit' />
</div>
</fieldset>
</form>
<!-- client-side Form Validations:
Uses the excellent form validation script from JavaScript-coder.com-->
<script type='text/javascript'>
// <![CDATA[
var pwdwidget = new PasswordWidget('thepwddiv','password');
pwdwidget.MakePWDWidget();
var frmvalidator = new Validator("register");
frmvalidator.EnableOnPageErrorDisplay();
frmvalidator.EnableMsgsTogether();
frmvalidator.addValidation("name","req","Please provide your name");
frmvalidator.addValidation("email","req","Please provide your email address");
frmvalidator.addValidation("email","email","Please provide a valid email address");
frmvalidator.addValidation("username","req","Please provide a username");
frmvalidator.addValidation("password","req","Please provide a password");
// ]]>
</script>
<!--
Form Code End (see html-form-guide.com for more info.)
-->
</body>
</html>
此文件运行良好,但事实上当前设置在提交后的网址中未显示“用户名”和“性别”。
<?php
session_start();
if (isset($_POST['username']) && isset($_POST['gender'])) {
$user = $_POST['username'];
$gen = $_POST['gender'];
echo 'Username: '. $username. ' - gender: '. $gender;
}
?>
这是我一直试图使用的session.php文件。
答案 0 :(得分:0)
我在这里没有得到你想要处理会话变量的内容,但只是为了让你的数据保持在会话中,执行此操作
$_SESSION["user"]
这样您就可以在整个项目中使用$_SESSION["gender"]
和post
,直到会话存在。
不要忘记开始会议。
由于您最近将表单方法更改为session.php
,请将$_POST["user"]
中的变量更改为<FORM name ="form1" method ="post" action ="radioButton.php">
<Input type = 'Radio' Name ='gender' value= 'male' required value="1"
<?PHP print $male_status; ?>
>male
<Input type = 'Radio' Name ='gender' value= 'female' required value="2"
<?PHP print $female_status; ?>
>female
<P>
</FORM>
,依此类推。
register.php
你在这里不需要表格。删除表格开始和结束标签。
现在我看到&#39;用户名&#39; name
中的字段名称,将username
内的session.php
更改为@AfterClass
public static void after() throws Exception
{
APIClient client = new APIClient("http://test.com/testrail");
client.setUser("test");
client.setPassword("Password1");
JSONObject c = (JSONObject) client.sendGet("/get_case/5905");
System.out.println(c.get("title"));
}
答案 1 :(得分:0)
使用这种方式非常简单的会话:----
session sets:--
session_start();
$_SESSION['value'] = 'tested';
会议得到: -
echo $_SESSION['value'];
<强>输出: - 测试强>