10/10/2018, 09:51
[HELP PHP]Giúp em đoạn code này với !
em làm 1 đoạn code để tạo đăng ký, đầu tiền, em tạo 1 form đăng ký như sau :
và 1 file reging.php với nội dung sau :
Nhưng khi test thử code thì nó lại báo :
Parse error: syntax error, unexpected T_STRING in ********/reging.php on line 39
nhưng line 39 là đoạn này :
em không hiểu là sai chỗ nào, mong các bác chỉ giúp ạ . ^_^
<html>
<center> <h1> Registration Form : </h1><br><br>
<form action="reging.php" method="post">
<table><td>user name :<br>
Pass : <br>
Age : <br>
Full Name : <br>
mail : <br>
gender : <br>
</td>
<td>
<input type="text" name="name"><br>
<input type="password" name="pass"><br>
<input type="text" name="age"><br>
<input type="text" name="fname"><br>
<input type="text" name="mail"><br>
Boy <input type="radio" name="gender" value="boy"> Girl <input type="radio" name="gender" value="girl"><br>
</td></table>
<br>
<table><td><input type="submit" value="ok"></td><td><input type="reset" value="Clear All"></td>
</form>
</center>
</html>
<center> <h1> Registration Form : </h1><br><br>
<form action="reging.php" method="post">
<table><td>user name :<br>
Pass : <br>
Age : <br>
Full Name : <br>
mail : <br>
gender : <br>
</td>
<td>
<input type="text" name="name"><br>
<input type="password" name="pass"><br>
<input type="text" name="age"><br>
<input type="text" name="fname"><br>
<input type="text" name="mail"><br>
Boy <input type="radio" name="gender" value="boy"> Girl <input type="radio" name="gender" value="girl"><br>
</td></table>
<br>
<table><td><input type="submit" value="ok"></td><td><input type="reset" value="Clear All"></td>
</form>
</center>
</html>
<?
$name = $_POST['name'];
$pass = $_POST['pass'];
$age = $_POST['age'];
$fname = $_POST['fname'];
$mail = $_POST['mail'];
?>
<?
mysql_conect ("localhost", "minhtn_testcod", "minhdeptrai");
$conect = mysql_conect ("localhost", "minhtn_testcod", "minhdeptrai");
if (!$conect)
{
echo "There is a problem to conect to the MySql Sever ! Pleas try again later !";
}
?>
<?
mysql_select_db ("minhtn_testcode");
$select = mysql_select_db ("minhtn_testcode");
if (!$select)
{
echo "There is a problem to select database ! Pleas try again later !";
}
?>
<?
$reg = "INSERT INTO MINHTN_TESTCODE (name, pass, age, fname, mail, gender) VALUES($name, $pass, $age, $fname, $mail);
mysql_query ($reg);
$reg2 = mysql_query ($reg);
if (!$reg2)
{
echo "There is a problem to creat new user ! Please contact us or try again later";
}
else
{
echo "Congralution ! The user register has been complete ! We sended an email to your email ! Pleas check it !";
?>
<?
mysql_close ($conect);
?>
$name = $_POST['name'];
$pass = $_POST['pass'];
$age = $_POST['age'];
$fname = $_POST['fname'];
$mail = $_POST['mail'];
?>
<?
mysql_conect ("localhost", "minhtn_testcod", "minhdeptrai");
$conect = mysql_conect ("localhost", "minhtn_testcod", "minhdeptrai");
if (!$conect)
{
echo "There is a problem to conect to the MySql Sever ! Pleas try again later !";
}
?>
<?
mysql_select_db ("minhtn_testcode");
$select = mysql_select_db ("minhtn_testcode");
if (!$select)
{
echo "There is a problem to select database ! Pleas try again later !";
}
?>
<?
$reg = "INSERT INTO MINHTN_TESTCODE (name, pass, age, fname, mail, gender) VALUES($name, $pass, $age, $fname, $mail);
mysql_query ($reg);
$reg2 = mysql_query ($reg);
if (!$reg2)
{
echo "There is a problem to creat new user ! Please contact us or try again later";
}
else
{
echo "Congralution ! The user register has been complete ! We sended an email to your email ! Pleas check it !";
?>
<?
mysql_close ($conect);
?>
Parse error: syntax error, unexpected T_STRING in ********/reging.php on line 39
echo "There is a problem to creat new user ! Please contact us or try again later";
Bài liên quan
ặc giờ thì lại lỗi line 54 (
Lỗi 54 là thiếu dấu này }
p/s sau khỉ thêm dấu } báo lỗi tiếp line 11 . Mong các anh support đến cùng, rất cảm ơn các anh ^_^
p/s chán thật ko có nút thanks ><
$conect = mysql_conect ("localhost", "minhtn_testcod", "minhdeptrai");
Chỉ cần:
$qr = mysql_query($sql);
if(!$qr){
echo 'Lỗi tạo mới...';
}
<?
$name = $_POST***91;'name'***93;;
$pass = $_POST***91;'pass'***93;;
$age = $_POST***91;'age'***93;;
$fname = $_POST***91;'fname'***93;;
$mail = $_POST***91;'mail'***93;;
$conect = mysql_connect ("localhost", "minhtn_testcod", "minhdeptrai");
if (!$conect)
{
echo "There is a problem to conect to the MySql Sever ! Pleas try again later !";
}
$select = mysql_select_db ("minhtn_testcode");
if (!$select)
{
echo "There is a problem to select database ! Pleas try again later !";
}
$reg = "INSERT INTO MINHTN_TESTCODE (name, pass, age, fname, mail, gender) VALUES('$name', '$pass', '$age', '$fname', '$mail')";
$reg2 = mysql_query ($reg);
if (!$reg2)
{
echo "There is a problem to creat new user ! Please contact us or try again later";
}
else
{
mysql_close ($conect);
}
?>