Jump to content


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


Adding form value to URL

Recommended Posts

Maybe I've been looking at it too long. I just want it to add

[code] picture=$_POST['picture'] [/code]

after the ? it is already adding to the URL.

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO cmsarticles (title, tagline, author, picture, `section`, thearticle, approved) VALUES (%s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['title'], "text"),
                       GetSQLValueString($_POST['tagline'], "text"),
                       GetSQLValueString($_POST['author'], "text"),
                       GetSQLValueString($_POST['picture'], "text"),
                       GetSQLValueString($_POST['section'], "int"),
                       GetSQLValueString($_POST['thearticle'], "text"),
                       GetSQLValueString($_POST['approved'], "text"));

  mysql_select_db($database_core, $core);
  $Result1 = mysql_query($insertSQL, $core) or die(mysql_error());

  $insertGoTo = "pictureupload.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  header(sprintf("Location: %s", $insertGoTo));

It's times like these when I realize what a PHP beginner I am! So much for patting myself on the back...


Share this post

Link to post
Share on other sites
Is this what you are trying to do?


if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?".$_POST['picture'];


Share this post

Link to post
Share on other sites


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.