Forums

PHP

This topic is locked

update form to mysql with string

Posted 19 Nov 2007 23:29:02
1
has voted
19 Nov 2007 23:29:02 chuck wagon posted:
I want to update a form and when it updates i want it to go to a .php?post=fitz page.

If i do this:

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

it works fine.

but when i do this:

$updateGoTo = "edit.php?post=fitz";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}

i get a parse error.

what is the syntax?

do i have to do something like
$post = "?post="$row_add['post'];
$updateGoTo = "edit.php"$post

or do i put that in the header(sprintf ???

any help would be greatly appreciated. this is something i've been trying to figure out for a while.

Thanks.
Fitz<font color=red></font id=red>

Edited by - firetiki on 19 Nov 2007 23:29:47

Reply to this topic