Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
i have been writing a small guest book code. first a text box to write and send it to database;Code: Select all
<html>
<head>
<title>ziyaretci defteri</title>
<body> <center>
<form name="ziyaretci" action="insert1.php" method="POST">
<p>isminiz : <input type="text" size="20" maxlength="30" name="user"></p>
<p>mesajiniz : <textarea name="message" rows="4" cols="40"></textarea></p>
<p><input type="submit" name="gonder" value="gonder">
</form>
<?php
$user=$_POST['user'];
$message=$_POST['message'];
$gonder=$_POST['gonder'];
$date=date('Y-n-j');
if($gonder)
{
$db=mysql_connect('localhost', 'root', '123456') or die('not connected');
if($db)
mysql_select_db('siyabendd') or die('not selected');
// Performing SQL query
$query = "INSERT INTO forum1 VALUES('".$user."', '".$date."', '".$message."')";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Closing connection
mysql_close($db);
}
?>Code: Select all
<html>
<head>
<title>ziyaretci defteri</title>
<body> <center>
<form name="ziyaretci" action="insert1.php" method="POST">
<p>isminiz : <input type="text" size="20" maxlength="30" name="user"></p>
<p>mesajiniz : <textarea name="message" rows="4" cols="40"></textarea></p>
<p><input type="submit" name="gonder" value="gonder">
</form>
<?php
$user=$_POST['user'];
$message=$_POST['message'];
$gonder=$_POST['gonder'];
$date=date('Y-n-j');
if($gonder)
{
$db=mysql_connect('localhost', 'root', '123456') or die('not connected');
if($db)
mysql_select_db('siyabendd') or die('not selected');
// Performing SQL query
$query = "INSERT INTO forum1 VALUES('".$user."', '".$date."', '".$message."')";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
// Closing connection
mysql_close($db);
}
?>but i have two problems;
1- when the user wants to write his message and enters to go the new line and send the all message is shown in only one line with my second code. so this view is not good. how can i display the message as the user had writen.
2- this is about view of message, too. when the message is too long, it goes to right and a horizantal scroll bar appears. why it doesn't go down a new line at the end of the table.
thanks all in advance
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]