Jump to content

[SOLVED] php forms


dropfaith

Recommended Posts

example  http://dropfaithproductions.com/test/image.php?Id=33

 

i need the form to submit and then return to the same image as it is now it drops the image id off and goes to image.php without an id

 

<?php
}
else
{
   // includes
    include("template/conf.php");
    // set up error list array
    $errorList = array();
    $count = 0;
    // validate text input fields
    $comment  = mysql_escape_string($_POST['comment']);
    $Id = mysql_escape_string($_POST['Id']);
    // check for errors
    // if none found...
    if (sizeof($errorList) == 0)
    {
        // open database connection
        $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
        // select database
        mysql_select_db($db) or die ("Unable to select database!");
        // generate and execute query
        $query = "INSERT INTO commenttable (comment, Id) VALUES('$comment','$Id')";
        $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
        // print result
        echo "<font size=-1>Comment successful.";
        // close database connection
        mysql_close($connection);
    }
    else
    {
        // errors found
        // print as list
        echo "<font size=-1>The following errors were encountered: <br>";
        echo "<ul>";
        for ($x=0; $x<sizeof($errorList); $x++)
        {
            echo "<li>$errorList[$x]";
        }
        echo "</ul></font>";
    }
}

?>

Link to comment
https://forums.phpfreaks.com/topic/123055-solved-php-forms/
Share on other sites

Archived

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

×
×
  • Create New...

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.