pchopder Posted October 16, 2007 Share Posted October 16, 2007 //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 More sharing options...
trq Posted October 16, 2007 Share Posted October 16, 2007 Sorry, but I don't see a question in your post. Link to comment https://forums.phpfreaks.com/topic/73410-solved-blank-page/#findComment-370331 Share on other sites More sharing options...
jd2007 Posted October 16, 2007 Share Posted October 16, 2007 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 More sharing options...
pchopder Posted October 16, 2007 Author Share Posted October 16, 2007 Thank you, jd2007 I did not know you could use Brackets "{, }" in different ways and the way you showed me is much less confusing Problem Solved!!! Link to comment https://forums.phpfreaks.com/topic/73410-solved-blank-page/#findComment-370344 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.