Matpatnik Posted December 18, 2006 Share Posted December 18, 2006 Hi guys,I'm not sure how to transfer my variable to the submit page. every else variable are send well except those two.Here the form.php <th bgcolor="#FFFFFF" width="34%">Picture Real Name</th> <td bgcolor="#E5E5E5" width="66%"><?php if ($row['picture_realname'] == "") { echo "<input name=\"picture_realname\" type=\"text\" size=\"40\" >"; } else { $_POST['picture_realname'] = $picture_realname; echo $picture_realname; }?> </td> </tr> <tr> <th bgcolor="#FFFFFF" width="34%">Picture Name</th> <td bgcolor="#E5E5E5" width="66%"><?php if ($row['picture_name'] == "") { echo "<input name=\"picture_name\" type=\"text\" size=\"40\" >"; } else { $_POST['picture_name'] = $picture_name; echo $picture_name; }?> </td> I tought by assigning the global variable $_POST['picture_name'] = $picture_name; would fix the problem but it didn't.Here the submit.php case "picture": $sql = "UPDATE picture SET picture_name = '" . $_POST['picture_name'] . "', picture_date = CURDATE(), picture_usefor = '" . $_POST['picture_usefor'] . "', picture_info = '" . $_POST['picture_info'] . "', picture_type = '" . $_POST['picture_type'] . "', picture_weight = '" . $_POST['picture_weight'] . "', picture_realname = '" . $_POST['picture_realname'] . "', picture_ofmonth = '" . $_POST['picture_ofmonth'] . "' WHERE picture_id = '" . $_GET['id'] . "'"; break; Like I said every variable are fine excepte $picture_realname and $picture_name.If those to variable are empty then a text box will show insted fo the variable (that is fine and the submit too) but when the variable is not empty it show the name and realname... but when submited those two variable turn empty! so I have to goback and reedit them with the proper information Is there a way to send my two variable and get the proper information?Thank you for your helpMatpatnik Link to comment Share on other sites More sharing options...
justsomeguy Posted December 18, 2006 Share Posted December 18, 2006 The $_POST variable does not carry across from page to page. The information submitted through the POST method does carry across, but the $_POST variable gets created on every page, it doesn't move from page to page.If you want to submit something through POST but not have it in a visible element, use a hidden element:<input type="hidden" name="picture_name" value="<?php echo $picture_name; ?>"> Link to comment Share on other sites More sharing options...
Matpatnik Posted December 18, 2006 Author Share Posted December 18, 2006 I need to show those two variable but I don't want them to be able to modify it (they can modify the rest of the form).So if I understand, I just have to remplace } else { $_POST['picture_realname'] = $picture_realname; echo $picture_realname; } by } else { echo "<input type=\"hidden\" name=\"picture_name\" value=\"" . $picture_name . "\">" . $picture_realname; } Yeah, it make sence. I don't know why I didn't think about this earlier Thank you justsomeguy! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now