Jump to content

Adding form value to URL


mourningreign

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.

[code]
$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));
}
[/code]

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

Rage
Link to comment
https://forums.phpfreaks.com/topic/5003-adding-form-value-to-url/
Share on other sites

Archived

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

×
×
  • Create New...

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.