HTML/PHP Help >.>

Anything else. Post a funny site or tell us about yourself. Discuss current events or whatever else you want. Post off topic threads here.
Post Reply
User avatar
Dystopia
Advanced Member
Posts: 2317
Joined: Thu Jan 04, 2007 8:37 pm
Quick Reply: Yes
Location: Off Topic

HTML/PHP Help >.>

Post by Dystopia »

on my webby for school, im trying to get my text fields to log all entries so my html file looks like


...."
<center><font> Please enter your first and last name.</font></center>
<form action="PHP.php" method="get" autocomplete="off">
First Name: <INPUT name="First Name" value="" size="10"><BR>
Last Name: <INPUT name="Last Name" value="" size="10"><BR>
<CENTER><INPUT type="submit"></CENTER>
</form>"

PHP.php contains

"<?php
header("Location: Home.html");
$handle = fopen("log.txt", "a");
foreach($_GET as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, "=");
fwrite($handle, $value);
fwrite($handle, "\r\n");
}
fwrite($handle, "\r\n");
fclose($handle);
exit;
?>"

and it should record entries in log.txt

but when i try 2 submit the names 2 see if it recoreded, and nothing comes up in teh log :(

$value) { fwrite($handle, $variable); fwrite($handle, "="); fwrite($handle, $value); fwrite($handle, "\r\n"); } fwrite($handle, "\r\n"); fclose($handle); exit; ?>



btw i have no idea if teh php is right, its probably where the wrong is we didnt take php yet :x

any help pleaseee
Image

User avatar
FX
Active Member
Posts: 857
Joined: Tue Sep 04, 2007 6:21 am
Quick Reply: Yes
Location: Rappelz<botroad online

Post by FX »

are you trying to hack us???
lol jp i wish i could help ya, im still trying to learn all the lang :/
Image

User avatar
Dystopia
Advanced Member
Posts: 2317
Joined: Thu Jan 04, 2007 8:37 pm
Quick Reply: Yes
Location: Off Topic

Post by Dystopia »

i are big noobie, im ehh @ html and big noobie wit php :(
Image

User avatar
Millenium
Ex-Staff
Posts: 2732
Joined: Tue Oct 24, 2006 6:36 pm
Quick Reply: Yes
Location: Waterloo
Contact:

Post by Millenium »

I hate PHP, I'll never code anything myself in it O_O

But I'd suggest you use the DIV tags and set the alignment to center instead of using the HTML CENTER tag.
DID YOU KNOW? Milly has retired!!!!


Status: Into Minecraft

ImageImage

User avatar
Cruor
Loyal Member
Posts: 1999
Joined: Wed Apr 12, 2006 1:22 am
Quick Reply: Yes
Location: Off topic

Post by Cruor »

Sounds like the file is read-only. Also, you can combine variables and strings with a period. :P

Try this:

Code: Select all

<?php
ob_start();
$handle = @fopen("log.txt", "ab") or die("Couldn't open log for writing!");
header("Location: Home.html");
foreach($_GET as $variable => $value)
   fwrite($handle, $variable."=".$value."\r\n");
fwrite($handle, "\r\n");
fclose($handle);
?>
If fopen can't open the file for writing then you'll get the error, otherwise the header will be sent as normal.
Image

Post Reply

Return to “Off Topic Lounge”