dropfaith Posted September 6, 2008 Share Posted September 6, 2008 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 More sharing options...
revraz Posted September 6, 2008 Share Posted September 6, 2008 Since you are passing Id via a URL, you need ot use $_GET not $_POST. Link to comment https://forums.phpfreaks.com/topic/123055-solved-php-forms/#findComment-635488 Share on other sites More sharing options...
dropfaith Posted September 6, 2008 Author Share Posted September 6, 2008 but it has to post details to database therefor it shouldnt be get Link to comment https://forums.phpfreaks.com/topic/123055-solved-php-forms/#findComment-635497 Share on other sites More sharing options...
revraz Posted September 7, 2008 Share Posted September 7, 2008 Ok, then where are you using $_GET from the URL that you pass? Link to comment https://forums.phpfreaks.com/topic/123055-solved-php-forms/#findComment-635767 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.