Jump to content


Photo

Adding form value to URL


  • Please log in to reply
1 reply to this topic

#1 mourningreign

mourningreign
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 15 March 2006 - 04:00 AM

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

picture=$_POST['picture']

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...

Rage

#2 cunoodle2

cunoodle2
  • Members
  • PipPipPip
  • Advanced Member
  • 602 posts

Posted 15 March 2006 - 05:55 AM

Is this what you are trying to do?

<?php

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

?>

If the code was working and now it's not, something changed. Did you change any code?

yeah, just a little bit, I am trying to start from beginning and trace my steps to see what i did wrong unless you see it.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users