Php help
Started by rideth3, Jun 26 2006 11:36 PM
6 replies to this topic
#1
Posted 26 June 2006 - 11:36 PM
Im trying to make a profile system, and I use mkdir(), fopen(), and then fwrite(). All is good so far, except I need a way to have php in it, and I don't know how. Can you have the <? ?> tags inside a php script? Is there any other ways to do this? I know how to make the whole html part (it imports the stylesheet). Thanks!
#2
Posted 27 June 2006 - 12:01 AM
i'm confused on the question, so i'm guessin most others will to.
so when you say 'it' you mean.... ???
Quote
except I need a way to have php in it
so when you say 'it' you mean.... ???
#3
Posted 27 June 2006 - 01:42 AM
Heres the code
I that creates the directory, file, etc, but I need php code to go here:
I get a parse error if I have it like this
Hopefully you know what I mean now
$info=$_POST['info'];
$cdir=$_POST['cdir'];
$name=$_POST['name'];
$stringData = "<html><head><title>$name</title><style>@import url(/whatever/style.css);</style></head><body><center><br><Br><Br><b>Hello $name</b><Br><Br>$info</center></body></html>";
$dir = "/home/whatever/public_html/whatever/$cdir";
mkdir("/home/whatever/public_html/whatever/$cdir", 0755);
$FileName = "/home/whatever/public_html/whatever/$cdir/index.php";
$FileHandle = fopen($FileName, 'w') or die("can't open file");
echo "<br><a href='/whateverl/$cdir'>Click here to go to it'</a>";
$fh = fopen($FileName, 'w') or die("can't open file");
fwrite($fh, $stringData);
fclose($fh);
I that creates the directory, file, etc, but I need php code to go here:
$stringData = "<html><head><title>$name</title><style>@import url(/daniel/style.css);</style></head><body><center><br><Br><Br><b>Hello $name</b><Br><Br>$info</center></body></html>";
I get a parse error if I have it like this
$stringData = "<title><? echo "$name"; ?></title>";
Hopefully you know what I mean now
#4
Posted 27 June 2006 - 01:51 AM
$stringData = '<title><? echo "$name"; ?></title>';
#5
Posted 27 June 2006 - 07:05 AM
umm....
I'm confused as coolaid is....
$stringData = '<title>'. $name .'</title>';
I'm confused as coolaid is....
#6
Posted 27 June 2006 - 12:52 PM
oh i get it....
yes you can have open/close php tags within strings. and the reason you got the parse error is because you didn't escape the doublequotes.
$stringData = "<title><? echo \"$name\"; ?></title>";
yes you can have open/close php tags within strings. and the reason you got the parse error is because you didn't escape the doublequotes.
#7
Posted 27 June 2006 - 02:45 PM
Ohhh ok I see. Thanks!
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
