Mixing php with html5???

Dei,
[php]

<?php session_start(); ?>

<! DOCTYPE HTML>

Functions! <?php function getusername($user) { $flag=0; do { if($flag) { echo "UserName in use!"; } $user=""; ?> ?> $fname = "stuff/". $user; if(file_exists($fname)) { $flag=1; } else { $flag=0; } } while($flag=0); $_SESSION($user)=$user; } function writeuserstuff($user, $pw, $email, $city, $state) { $fname = "stuff/". $user; $user = $user . "!"; $pw = $pw . "!"; $email= $email. "!"; $city= $city. "!"; $state= $state. "!"; if(!(file_exists($fname))) { $fp = fopen($fname,"w"); if($fp) { fwrite($fp,"userstuff!"); fwrite($fp, $user); fwrite($fp, $pw); fwrite($fp, $email); fwrite($fp, $city); fwrite($fp, $state); } else { echo "name taken! try again, please.
"; } } else { echo "name taken! try again, please.
"; } } // Main echo "" // writeuserstuff("gimp","miki","[email protected]","middletown","ri"); echo "done
"; echo ""; echo "; ?> [/php] it gives me syntax error, unexpected end on line 62... cannot figure it out... second function works, though... Thanx ahead!!! Always, Jacques P.

before the first form, you’re closing the php code by using [php]?>[/php], but directly after the form, you use the closing tag again, instead of opening it.

[php]<?php
function getusername($user) {
$flag=0;
do {
if($flag) {
echo “UserName in use!”;
}
$user="";
?> //---------HERE YOU ARE CLOSING YOUR PHP CODE------------




?>//---------HERE YOU ARE CLOSING IT AGAIN---------------
$fname = “stuff/”. $user;
if(file_exists($fname)) {
$flag=1; [/php]

should be
[php]<?php
function getusername($user) {
$flag=0;
do {
if($flag) {
echo “UserName in use!”;
}
$user="";
?>



<? $fname = "stuff/". $user; if(file_exists($fname)) { $flag=1; [/php]

There was some more typos, but thanx for tip… got it running!!!

yw :smiley:

Sponsor our Newsletter | Privacy Policy | Terms of Service