Staredit Network

Staredit Network -> Computers and Technical -> notepad help!
Report, edit, etc...Posted by Jordan on 2006-06-22 at 04:29:23
okay im working on creating a notepad in php. i would like to know how I would make it so you could type the message in the text box click save and it would bring up the message.

im truly lost at this point, i'm connected to my database but when i try to hit save it wont bring up the message.

my code:

in mainframe.php i have
CODE
<?php
$con = mysql_connect("localhost","itech_db,"1111");
if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }
?>
<form name="adminnotes" method="post" action="../admin/notepad.php?save=comment">
<textarea rows='8' cols='58' name="comment">
Enter notes here!</textarea>
<input type='submit' value='Save Admin Notes' class='realdarkbutton' /></form>


and in notepad.php i have
CODE

<php?
if ($_GET['save']=='comment'){

$comment=$_POST['comment'];

$fp = fopen("data.txt", "a");
fputs ($fp, "$comment\n");
fclose ($fp);

echo "Thank you. Your information has been stored.";

}else{

$fp = fopen("data.txt", "r");
while (!feof($fp)){
$line_data = fgets($fp, 4096);
$record = explode("||", $line_data);
if (!$record[0]==""){
echo $comment;
?>


also i have connected to my database in notepad.php
Report, edit, etc...Posted by Mr_Mooo_Cow(U) on 2006-06-22 at 12:02:45
huh.gif
Report, edit, etc...Posted by Jordan on 2006-06-22 at 19:33:52
the <php? works just as <?php but ill try it
Report, edit, etc...Posted by MindArchon on 2006-06-22 at 20:24:16
Uh..

I would like to know why you connect to the database when you don't even use it.
Report, edit, etc...Posted by Jordan on 2006-06-22 at 20:50:27
its for storing past notes
Report, edit, etc...Posted by Doodle77(MM) on 2006-06-23 at 09:15:52
you have a mismatched quote near itech_db
Report, edit, etc...Posted by Shmeeps on 2006-06-24 at 03:08:58
Is that the whole script? Cause you have 4 open brackets ( { ) but only 1 close bracket ( } ) in the second script.
Report, edit, etc...Posted by brutetal on 2006-06-24 at 06:32:42
I don't see a reason for this to have 2 files, besides for the login database info.
Next Page (1)