|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
beginner seeks help
okay, so i had ago at matts news program, I thought it was great, so I thought it would be cool to customise it into a guestbook, anyways, as I am a pure beginner at this it didn't go to plan i guess, here is my code at the moment I'm getting an error on the line where the form starts. Its probably just complete crap what i've got there, but i guess its a start
Code:
<?php
if ( $action == "sign" ) {
echo( "Leave your mark!" );
echo( "<br><br>" );
echo( "<FORM ACTION="<?=$PHP_SELF?action=sign>" METHOD="POST" NAME="gbook">
Name:<BR>
<INPUT TYPE="text" SIZE="30" NAME="name" class="textbox"><BR>
Email:<BR>
<INPUT TYPE="text" SIZE="30" NAME="email" class="textbox"><BR>
The News:<BR>
<TEXTAREA NAME="message" COLS="40" ROWS="5"></TEXTAREA><BR><BR>
<INPUT TYPE="submit" NAME="submit" VALUE="Post it!" class=button>
<input type="reset" class="button"><BR>
</FORM>" );
$line = date("l, F dS Y - H:m:s",1000000000) . "|" . $HTTP_POST_VARS['name'];
$line .= "|" . $HTTP_POST_VARS['email'];
$line .= "|" . $HTTP_POST_VARS['message'];
$line = str_replace("rn","<BR>",$line);
$line .= "rn";
fwrite($fp, $line);
if(!fclose($fp)) {
echo "Error closing file!";
exit;
}
echo ( "<b>Message Added added!</b>
<a href="gbook.php">View Your Message</a>" );
}
exit;
}
echo (" <a href="$PHP_SELF?action=sign" class=link>Sign The Guest Book</a>");
echo ("<BR><BR>" );
$data = file('./yepyep/gbook.txt');
$data = array_reverse($data);
foreach($data as $element) {
$element = trim($element);
$pieces = explode("|", $element);
echo . "<b>Posted by <a href="mailto:$pieces[2]">" . $pieces[1] .
"</a> on" . $pieces[0] . "</b><br>" . $pieces[3] . "<br><br>";
}
?>
|
|
#2
|
|||
|
|||
|
RE: beginner seeks help
Whenever you use a quote (") inside of a quote ("), you need to escape the inside quote:
echo " I said,"hello" to him."; is wrong, it should be: echo " I said,"hello" to him."; also, on the portion that reads: <?=$PHP_SELF you don't need to do the <?= and the |
|
#3
|
|||
|
|||
|
RE: beginner seeks help
|
|
#4
|
|||
|
|||
|
RE: beginner seeks help
Hmm..I don't see a fopen call any where above that. You can't fclose a file that you haven't opened.
Please post the error message you get in the future and it may help to figure out exactly what is happening... |
|
#5
|
|||||
|
|||||
|
RE: beginner seeks help
okay, the error I get is
Parse error: parse error in /home/gmflp/public_html/test.php on line 45 here is my full code of what I have so far php Code:
|
|
#6
|
|||
|
|||
|
RE: beginner seeks help
You missed the closing ") on that last echo...
and check the syntax at the beginning of that same echo..looks like you forgot to escape the first quote of the <a> tag and forgot to use a quote to finish off the mailto: |
|
#7
|
|||
|
|||
|
RE: beginner seeks help
okay man, Ive made the changes now I get the same error, just a different line Parse error: parse error in /home/gmflp/public_html/test.php on line 62 which is basicly the same place php Code:
|