Jump to content


Photo

PHP and frontpage frames


  • Please log in to reply
No replies to this topic

#1 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 22 April 2006 - 05:48 PM

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)
<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>

Frames page(chat.php)(all frontpage junk!)
<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>

postmessage(chatp.php)(on the query the blank spot for the field value is post id!)
<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>

and last but not least the message page(chatm.php)
<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>

also i just changes the action to chatp.php... it didnt show the messages but the post worked!
"Syntax error" .. WHERE THE **** IS IT?!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users