PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
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]
Hi everyone,
I've got some code that submits the variables from a Form to MySQL. It works OK but there is an extra variable that needs to be sent that doesn't submit its data, a variable that was parsed from a refering file.
The variable is stored here: -
"
$FixedIDvalue = $_GET['FixedIDvalue'];
"
And here's the code: -
If I were to change the value of $FixedIDvalue to a number, eg: $FixedIDvalue = 1234; the value is successfully sent to my table, but not the value of the $_GET value.
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]
<?php
if(!isset($_POST['submit'])) {
?>
<form action="Reviewupdate01.php" method="post">
Your Name: <input type="text" name="Name" size="20">
Your Review: <input type="text" name="Review" size="50">
<!-- If your variable is received as a GET then you can add it into a hidden form field. -->
<input type="hidden" name="FixedIDvalue" value="<?php echo $_GET['FixedIDvalue']; ?>" />
<input type="submit" name="submit" value="Submit!">
</form>
<?php
}
else
{
// Change this to Post
$FixedIDvalue = $_POST['FixedIDvalue'];
$Name = $_POST['Name'];
$Review = $_POST['Review'];
mysql_db_query("vinylsur_music", "INSERT INTO `TrackReviews` (Name, Review, FixedID) VALUES ('$Name', '$Review', '$FixedIDvalue')");
}
?>