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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.