Jump to content

Line 2


ahpro

Recommended Posts

Ok, the code seems fine but then i put it on the net and it says problem with line 2. Any ideas as to why?

 

<? PHP
  $user = $_POST['uname'];
  $pwrd = $_POST['p1'];
  $check = $_POST['p '];

  $DOCU NT_ROOT = $_SERVER['DOCU NT_ROOT'];

?>
<HTML>
<HE D>
<TITLE>Reg tering your account</TITLE>
</HE D>
<BODY>
<?PHP
if ($pwrd  == $check) {
echo $user; ' ,your passwords do not match, please go back and type them again';
}

Link to comment
https://forums.phpfreaks.com/topic/41026-line-2/
Share on other sites

Ok, the code seems fine but then i put it on the net and it says problem with line 2. Any ideas as to why?

 

<? PHP
  $user = $_POST['uname'];
  $pwrd = $_POST['p1'];
  $check = $_POST['p '];

  $DOCU NT_ROOT = $_SERVER['DOCU NT_ROOT'];

?>
<HTML>
<HE D>
<TITLE>Reg tering your account</TITLE>
</HE D>
<BODY>
<?PHP
if ($pwrd  == $check) {
echo $user; ' ,your passwords do not match, please go back and type them again';
}

 

I'd have $pwrd as $pass

 

I may be reading this wrong as I am pretty new at this, but $_post, does that not mean your posting those details. I personally don't have $_post on any of the details.

Link to comment
https://forums.phpfreaks.com/topic/41026-line-2/#findComment-198663
Share on other sites

Your PHP tag is <? PHP. You have to get rid of the space.

 

You also have some funny things going on.

echo $user; ' ,your passwords do not match, please go back and type them again';

Should be something like

echo $user.', your passwords do not match, please go back and type them again';

Link to comment
https://forums.phpfreaks.com/topic/41026-line-2/#findComment-198664
Share on other sites

New Code

 

<?PHP
  $user = $_POST['uname'];
  $pwrd = $_POST['p1'];
  $check = $_POST['p1'];

  $DOCU NT_ROOT = $_SERVER['DOCUMENT_ROOT'];

?>
<HTML>
<HEAD>
<TITLE>Registering your account</TITLE>
</HEAD>
<BODY>
<?PHP
if ($pwrd == $check) {
echo '$user ,your passwords do not match, please go back and type them again';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/41026-line-2/#findComment-198668
Share on other sites

Welll this spot doesn't make sense:

 

<?PHP
if ($pwrd == $check) {
echo '$user ,your passwords do not match, please go back and type them again';
}
?>

 

If the passwords match your showing a message saying they don't.

 

You would do:

 

<?PHP
if ( $pwrd != $check) {
echo '$user ,your passwords do not match, please go back and type them again';
}
?>

Link to comment
https://forums.phpfreaks.com/topic/41026-line-2/#findComment-198670
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.