PDA

View Full Version : what is wrong with this code


asgsoft
11-02-2004, 05:04 PM
what is wrong with this code
<html>
<head>
<title>Php trials</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
echo "hello world";
?>
<?php
print "hello world";
?>
<?php
$message= "hello world";
echo "$message"
?>

<?php
$message= "great";
echo "I Feel $message today!";
?>

<?php
echo "I have \$53,000 dollars in my bank account.</font>;"
?>

<?php include header.tpl ?>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td>
<?php include nav.tpl ?>
</td>
<td>
<?php include body.tpl ?>
</td>
</tr>
</table>
<?php include footer.tpl ?>
<?php
if ($_GET['v'] == '') {
include home.tpl;
}
if ($_GET['v'] == '1') {
include games.tpl;
}
if ($_GET['v'] == '2') {
include toons.tpl;
}
if ($_GET['v'] == '3') {
include jokes.tpl;
}
?>


</body>
</html>

i know it sounds stupid but that was of a tutorial i did when i started php. i uploaded the file but lines of error came! :(

mahangee
11-02-2004, 05:24 PM
<html>
<head>
<title>Php trials</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
echo "hello world";

print "hello world";

$message= "hello world";
echo "$message";

$message= "great";
echo "I Feel $message today!";

echo "I have \$53,000 dollars in my bank account.";

include 'header.tpl';
?>
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td>
<?php
include 'nav.tpl';
?>
</td>
<td>
<?php include body.tpl ?>
</td>
</tr>
</table>
<?php
include 'footer.tpl';
?>
<?php
if ($_GET['v'] == '') {
include 'home.tpl';
}
if ($_GET['v'] == '1') {
include 'games.tpl';
}
if ($_GET['v'] == '2') {
include 'toons.tp'l;
}
if ($_GET['v'] == '3') {
include 'jokes.tpl';
}
?>


</body>
</html>
Try that, I added a few ; and a few ' ' and BTW error solving is a vital PHP skill.

asgsoft
11-02-2004, 05:27 PM
thanks alot i don't know what will happen without your help many thanks

thanks alot it works thank you teacher

mahangee
11-02-2004, 05:37 PM
Yeah just remember all PHP code lines must end with a ; and when including something put a 'single quote mark' around it.

asgsoft
11-02-2004, 08:52 PM
can you help me with this also please :(

<html>
<?php
$sendTo = "asmgomaa@hotmail.com"; // your email
$subject = "My Site Reply"; // subject you want
displayed
$header = "$headers = "From: $name <$email>\r\n";"; //
shows from asdasd and email says sadasd@dasdas.com

$email = $_POST['email']; // defines ['email'] in the
name tag of the input tags in HTML
$msg = $_POST['msg']; // same here for msg

mail($sendTo, $subject2, $msg, $headers); // mail()
send each of those things. Starts with your email,
then subject, message, and the header. such as...
Abdulrahman Gomaa <asmgomaa@hotmail.com>
?>

now for your html code, right outside those php tags,
put in this...

<for method="post" action="<?php echo
$_SERVER['PHP_SELF']; ?>">
<input name="email">
<input name="msg">
<input type="submit">
</form>
</html>

thank you

mahangee
11-02-2004, 09:08 PM
Tell me what error you get? THen I will be able to solve the probllem.

oblivious
11-02-2004, 09:11 PM
You really need to start listing the errors otherwise we will have to waste our time "installing" the script and running it to check it ourselves.

From now on post the error you get or we will stop helping you!

mahangee
11-02-2004, 09:17 PM
Also put your actual content in <body> tags. That could be causing a problem.

asgsoft
11-02-2004, 09:20 PM
for the second code it says Parse error: parse error,
unexpected T_VARIABLE in /home/asgsoft/public_html/php/form.php on line 13
for both :(

mahangee
11-02-2004, 09:25 PM
$sendTo = "asmgomaa@hotmail.com"; // your email
$subject = "My Site Reply"; // subject you want
displayed
$header = "From: $name <$email>\r\n"; //
shows from asdasd and email says sadasd@dasdas.com

$email = $_POST['email']; // defines ['email'] in the
name tag of the input tags in HTML
$msg = $_POST['msg']; // same here for msg


Try that.

asgsoft
11-03-2004, 12:30 PM
but what about the first code? it says the same message but with the line number 50. i will try this when i get home as i am currently in school then i will post in what the result was

asgsoft
11-04-2004, 05:18 PM
unexpected T_VARIABLE in /home/asgsoft/public_html/php/form.php on line 6 for the form and line 13 for the index can you please tell me what is going on?

mahangee
11-04-2004, 05:29 PM
T_VARIABLE means there is an error is your written code either you've missed a $ or a : or even a ""

asgsoft
11-05-2004, 12:41 PM
on the line mentioned?

mahangee
11-05-2004, 03:46 PM
On the line mentioned or a line above.

asgsoft
11-05-2004, 04:19 PM
ok thanks

TheRudy
11-09-2004, 08:34 PM
hmmm mahangee, you beat me before i could post that fix!
Stupid slow ISP!

EDIT: Basically you cannot use "text "text"; ";

mahangee
11-09-2004, 08:35 PM
Originally posted by TheRudy@Nov 9 2004, 10:34 PM
hmmm mahangee, you beat me before i could post that fix!
Stupid slow ISP!
7241

Your ISP must be extremely slow because I posted them a few days ago :D*hehe*

TheRudy
11-09-2004, 08:37 PM
Yeah i just saw that there is also page 2 lol, i'm new to this IB. Only used phpBB so far...

Edit: forgot to say, sorry for that and this post!