For future note: please post code within tags, as I have done below for you. It's easy to do, just use the Code button when you are composing your message.
new programmer:
I want to pass the variable "id" that is in this url
<?php
echo "The Value of action is:".$_POST['$id'];
$accountid = $_POST['custid'];
$email = $_POST['email'];
$password = $_POST['password'];
{
$query = "INSERT INTO account (custid, email, password)" .
" VALUES ('$accountid', '$email', '$password')";
$result = mysql_query($query);
if ($result)
echo "<h2>Updates posted to account</h2>\n";
else
echo "<h2>Sorry, there was a problem posting your updates</h2>\n";
echo "<a href=\"index.php?content=showaccount&id=$custid\">Return to show account</a>\n";
}
?>
I keep getting echo Sorry, there was a problem posting your updates
It's beacause the ID is not being passed to this page....
Are the 2 excerpts from the same file, index.php? That wasn't clear to me. If so, you didn't show where the value of $id comes from. Since that's what seems to be wrong, it would be rather important to show us where its value comes from. Also, perhaps this is because you haven't showed all of your code, there doesn't seem to be a closing </form> tag, although that's not likely to affect your problem.
Well, your form is using method=post, but the URL you are showing is passing 2 variables as GET, not POST. So $_POST['id'] will never contain a value. It appears that what you may have intended is either $_POST['custid'] or $_GET['id'].
$result = mysql_query($query) or die("Insert failed: ".mysql_error());
Apart from your immediate problem, you're really asking for trouble by accepting those POST values without "sanitizing" them, in case a hacker decides that he wants to bomb your site. Read about how to use mysql_real_escape_string()!