minichat

mini chat on php

Page 1 of 1

7 Replies - 1677 Views - Last Post: 27 January 2009 - 07:59 AM Rate Topic: -----

#1 kenmay09  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-January 09

minichat

Posted 25 January 2009 - 05:01 AM

$chat;

$nick;



session_start();

session_register("nick", $nick);

?>

<frameset rows="563,62" cols="*">

<frame name="posts" src="chat.php?action=posts&nick=<?php echo $nick; ?>&chat=<?php echo $chat; ?>">

<frame name="form" src="chat.php?action=form&nick=<?php echo $nick; ?>">

</frameset>

<noframes>



that's my code for the log-in.. but the prob is the frameset.... when i view the output, theirs an error!
the frameset wont appear on my window.

Is This A Good Question/Topic? 0
  • +

Replies To: minichat

#2 rmccarter721  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 8
  • View blog
  • Posts: 139
  • Joined: 10-September 07

Re: minichat

Posted 25 January 2009 - 06:25 AM

When you are using php you should look into using php includes rather than framesets.

what is the error you get?

and where do you set the values of $nick and $chat?

This post has been edited by Furnfield: 25 January 2009 - 06:31 AM

Was This Post Helpful? 0
  • +
  • -

#3 kenmay09  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 25-January 09

Re: minichat

Posted 26 January 2009 - 02:36 AM

on declaring the variables.... that's the error..

and theirs no output when i put frameset on my code..
Was This Post Helpful? 0
  • +
  • -

#4 Auzzie  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 43
  • View blog
  • Posts: 573
  • Joined: 20-January 09

Re: minichat

Posted 26 January 2009 - 08:35 AM

What he means is where do you get a value for $nick ? Also i take it you did remember to put the tags around the PHP code <?php and ?> because from what snippet we can see, $nick and $chat are both initialized with no values so session registering it would be of no use neither would echo'ing them
Was This Post Helpful? 0
  • +
  • -

#5 sam_benne  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 16
  • View blog
  • Posts: 732
  • Joined: 16-January 08

Re: minichat

Posted 26 January 2009 - 08:59 AM

One tip always put
session_start();


At the top of everything. As if you notice anything that is above it like HTML can cause it to error. So its best to start that first.
Was This Post Helpful? 0
  • +
  • -

#6 rmccarter721  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 8
  • View blog
  • Posts: 139
  • Joined: 10-September 07

Re: minichat

Posted 26 January 2009 - 09:29 AM

You set variables using

$chat = 'some_value';
$nick = 'Furnfield';


just incase you haven't realised
Was This Post Helpful? 0
  • +
  • -

#7 Valek  Icon User is offline

  • The Real Skynet
  • member icon

Reputation: 542
  • View blog
  • Posts: 1,713
  • Joined: 08-November 08

Re: minichat

Posted 27 January 2009 - 06:14 AM

PHP is a loose language, so you don't have to initialize and/or typecast variables before you use them. You can declare them on the fly. So you don't have to declare $nick or $chat until you assign them a value. Until then, they are assumed to have a value of NULL.

This post has been edited by Valek: 27 January 2009 - 06:14 AM

Was This Post Helpful? 0
  • +
  • -

#8 CTphpnwb  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2911
  • View blog
  • Posts: 10,083
  • Joined: 08-August 08

Re: minichat

Posted 27 January 2009 - 07:59 AM

View Postsam_benne, on 26 Jan, 2009 - 07:59 AM, said:

One tip always put
session_start();


At the top of everything. As if you notice anything that is above it like HTML can cause it to error. So its best to start that first.

Well, almost everything. You need to put class definitions above session_start.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1