|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Chatscript error in script by Tim Pabst
I was trying to get the chatscript to work, taken from the tutorial on http://www.devarticles.com/c/a/MySQL/A-MySQL-Driven-Chat-Script/
I'm happy to see the code have been put in to use as well, as I'm a designer, not a programmer. But I get some problems along the way. I figure some of this code might be wrong? I use the first piece of code as an exampel: function ShowLoginForm() { ?> <b>Enter Your NickName</b> <form name="chat" method="post" action="chat.php" target="_top"> <input type="text" name="nick" size="20"> <input type="hidden" name="action" value="enter"> <input type="hidden" name="chat" value="<font color=FF0000><b>Enters the Room</b></font>"> <input type="submit" name="Submit" value="Submit"> </form> <?php } I get that the bottom } is misplaced, and I can't see any logic in ?> being placed in top of the code and <?php in the bottom? This is done on several or all (I don't remember as I write) of the functions made in this tutorial?! Can someone help me, please?? ![]() |
|
#2
|
||||
|
||||
|
its in the right place... since it closes off the function
if you notice, right after the function declaration, function ShowLoginForm() { , there's a break in the PHP, ?> . This is where the HTML is... the idea being that it's easier than typing echo statements before each line of HTML... Finally, after the HTML we come back to the PHP, <?php , and close the function... The code you've presented is correct. Well, the only error i see is the grammatical mistake "Enters the Room"... heh... but that won't affect anything... Are you receiving an error when you try to run the code? if so, what's the error? |
|
#3
|
||||
|
||||
|
In an effort to compare and contrast the two different styles of writing that function...
i've coded what it might look like using echo statements... but again, from what I can tell, the function as you've pasted it is correct. PHP Code:
Its really just a question of style and which way the programmer prefers... Again I ask, are you receiving an error when you try to run the code? if so, what's the error? |
|
#4
|
|||
|
|||
|
Okay, thanks for sorting that out, the thing with the <?php! Now it's understandable why it's placed in the position it appears
![]() But as I said in the first post, as an error message when trying to run the script I get that the bottom } (the symbol } that's supposed to close the function) is misplaced... You can check the error message at http://marius.o2mlab.com/chat/test.php , maybe that will be more helpful?! Thanks for your help so far, appreciate it I really hope we can get this sorted out, would love to have a great chat at the website... Peace Out for now... |
|
#5
|
||||
|
||||
|
is the script displayed your ENTIRE script?
if it is, I suggest putting another <?php at the very beginning and another ?> at the very end. If not, could you post the rest of it too? |
|
#6
|
|||
|
|||
|
No, that's not close to the entire code, that was just an exampel of why I thought something was wrong...
But yeah, I did forget the start and end <?php and ?>... Now, with some editing work, I'm getting closer, but still get som errors... The code may bee seen at http://marius.o2mlab.com/chat/chatcode.txt, and the script with the code as shown over can be tested at http://marius.o2mlab.com/chat/chat.php. PS: the password's kept for safety in the codetext.php, it's used in the code on chat.php... Maybe that may clear things up even more...?! ![]() |
|
#7
|
||||
|
||||
|
is this the error you're referring to?
Fatal error: Call to undefined function: showaddposts() check the spelling, or even if thefunction exists... |
|
#8
|
|||
|
|||
|
I got another error before this error leads me to the page telling me that the showAddForm doesn't exist... and according to the code i put in the post over, this function exists, doesnt it?
![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > Chatscript error in script by Tim Pabst |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|