Jump to content

[SOLVED] Blank Page...


pchopder

Recommended Posts

//index.php
<HTML>
<body><pre>
<form action="index.php" method="post">
Name:<input type="text" name="names">
Message:<input type="text" name="messages">
<input type="submit" value="Submit">
</form></pre>
<?
$message = $_POST['messages'];
$name = $_POST['names'];
if($message == ""){
print "No message here.";
} else {
if($name == ""){
print "Name was left blank so message was blocked.";
} else {
print "$name : $message"
}
}
?>
</body>
</HTML>

What I'm trying to do is make a chatroom this is for 1 textbox but I'm trying to make it extend to 25 messages then erase the oldest    but this one won't even work I'm not to great at php I'm a beginner I plan to design games and such in php but I don't plan on it soon due to the complexity of advanced php  I'm just learning the basics now...

 

[Edit]

Sorry... the question is How do I manage to make this work with a form on top and the posted text below?

Link to comment
https://forums.phpfreaks.com/topic/73410-solved-blank-page/
Share on other sites

its better and good practice to have a separate php page....

 

the codes u have given have a problem :

 

u forgot the semicolon (;) here:

 

print "$name : $message"

 

please indent code properly like this :

 

$message = $_POST['messages'];
$name = $_POST['names'];
if($message == "")
{
print "No message here.";
}
else
{
if($name == "")
{
  print "Name was left blank so message was blocked.";
}
else
{
  print "$name : $message";
}
}

 

Link to comment
https://forums.phpfreaks.com/topic/73410-solved-blank-page/#findComment-370342
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.