Results 1 to 2 of 2

Thread: Postin problem

  1. #1
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Postin problem

    When i tring to post from web to table it posting empty info, and when i refreshing page where i inserted <form> system to post info it again posting for no reson empty info in database, any ideas how to fix it?

  2. #2
    Join Date
    Sep 2010
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    function chat()
    {

    $prisijungimas = mysql_connect("localhost","root","") or die("Neprisijungei!");
    mysql_select_db("vadimo") or die("Nerasta duomenu baze!");
    $query = "SELECT Vardas, Texstas FROM anonimchat";
    $result = mysql_query($query);

    while($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
    echo "
    <table bordercolor='#00CC00' border='none'>
    <tr>
    <td height='12'>
    <a><br>Name:</a>
    </td>
    <td>
    <b>{$row['Vardas']}</b> <br>" .

    " </td>
    </tr>
    <tr>
    <td><a>Comment:</a>
    </td>
    <td>
    <b> {$row['Texstas']}</b>
    </td>
    </tr>
    </table>
    <br><hr size='1'>
    ";
    }

    echo '
    <form action="index.php?ms=ch" method="post">
    <table bordercolor="#860000" border="none">
    <tr>
    <td height="32">
    <a>Name:</a>
    </td>
    <td>
    <input type="name" name="Vardas" />
    </td>
    </tr>
    <tr>
    <td>
    <a>Comment:</a>
    </td>
    <td>
    <textarea name="Texstas" value="Texstas" cols="56" rows="10"></textarea><br>
    </td>
    </tr>
    <tr>
    <td>
    <input type="submit" value="Comment" name="P" />
    </td>
    </tr>
    </table>

    </form>
    ';
    $P = mysql_connect ("localhost","root","") or die("Nepavyko prisijunkti prie Mysql!");

    mysql_select_db ("vadimo");

    $idejimasilentele="INSERT INTO anonimchat (Vardas, Texstas) VALUES ('$_POST[Vardas]','$_POST[Texstas]')";


    if (!mysql_query($idejimasilentele, $P))
    {
    die('Error: ' . mysql_error());
    }
    echo "Commented!";
    mysql_close($P);

    }

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •