Jump to content

Archived

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

legohead6

PHP and frontpage frames

Recommended Posts

ok... First i had 1 page with the message box and the results....(but you had to click refresh to see posts..) so i put a meta refresh in(works great) but then it was refreshing the input box to so i decided to use frontpages frames page and solve the issue!(it did kinda) so know i have the frames page and a chatp.php and chatm.php(m=message p=post) and the entering page where a user types there name in(GET METHOD) but it seems since i put the framse page on it wont GET the name and its leaving it blank...I have tried changing the action between chatP and the frames page but nothings working please help!

heres the chat room!
[a href=\"http://www.mattswebpage.com/test/chatroom/form1.php\" target=\"_blank\"]http://www.mattswebpage.com/test/form1.php[/a]

and heres the script for the 4 pages!

Name insert!(form1.php)
[code]<html>


<form method="Get" name="test" action="chatp.php">
  <p>Name: <input type="text" name="na" size="27"></p>
  <input type="submit" name="submit" value="Enter chat!">

</form>

</html>[/code]

Frames page(chat.php)(all frontpage junk!)
[code]<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta name="Microsoft Border" content="t, default">
</head>

<frameset rows="*,20%">
  <frame name="main" target="footnotes" src="chatm.php">
  <frame name="footnotes" src="chatp.php">
  <noframes>
  <body>

  <p>This page uses frames, but your browser doesn't support them.

  </body>
  </noframes>
</frameset>

</html>[/code]

postmessage(chatp.php)(on the query the blank spot for the field value is post id!)
[code]<html>

<head>

</head>

<?php
echo "<form method='POST'>
Message:<input type='text' name='mess'><input type='submit' value='Send' name='send'><br><br>";

if(isset($_POST['send'])){

$username="**";
$password="**";
$database="**";

$name=$_GET['na'];
$sub=$_POST['mess'];

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");

$query = "INSERT INTO chatroom VALUES ('$name','$sub','')";
$result = mysql_query($query);
}
?>
</html>[/code]

and last but not least the message page(chatm.php)
[code]<html>

<head>
<meta http-equiv="refresh" content="1">
</head>

<?PHP
$username="**";
$password="**";
$database="**";

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");


$query2 = "SELECT * FROM chatroom ORDER BY post_id DESC LIMIT 10";

$result2 = mysql_query($query2) or die ("Error in query: $query2. ".mysql_error());

while($row2 = mysql_fetch_row($result2)) {

echo "$row2[0]: $row2[1]<br>";
}
?>
</html>[/code]

also i just changes the action to chatp.php... it didnt show the messages but the post worked!

Share this post


Link to post
Share on other sites

×

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.