PHP form reloads current page on POST action, rather than displaying 'success.php' page. Why? -


i have php form submits data database. form action code follows:

<form action="<?php echo $editformaction; ?>"       method="post" name="form1" id="form1"> 

the $editformaction references following block of 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 gifts (giftid, customerid, itemtype, itemtitle,                                                                                            itemdescription, itemurl, dateadded, received, datereceived, vendor, ordernumber) values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",                    getsqlvaluestring($_post['giftid'], "int"),                    getsqlvaluestring($_post['customerid'], "int"),                    getsqlvaluestring($_post['itemtype'], "text"),                    getsqlvaluestring($_post['itemtitle'], "text"),                    getsqlvaluestring($_post['itemdescription'], "text"),                    getsqlvaluestring($_post['itemurl'], "text"),                    getsqlvaluestring($_post['dateadded'], "date"),                    getsqlvaluestring($_post['received'], "text"),                    getsqlvaluestring($_post['datereceived'], "date"),                    getsqlvaluestring($_post['vendor'], "text"),                    getsqlvaluestring($_post['ordernumber'], "text"));  mysql_select_db($database_testing_registryconnection, $testing_registryconnection); $result1 = mysql_query($insertsql, $testing_registryconnection) or die(mysql_error());  $insertgoto = "success.php";     if (isset($_server['query_string'])) {         $insertgoto .= (strpos($insertgoto, '?')) ? "&" : "?";         $insertgoto .= $_server['query_string'];     }     header(sprintf("location: %s", $insertgoto)); } 

i've used variation of code in many other pages, specific project, while form data indeed inserted mysql database, form page reloads display blank form. , if remember correctly, exact code worked supposed while on project, must have changed interfering redirect 'success.php'.

any tips should checking? need see more code?

to combine 2 comments above... try first replace $insertgoto absolute value (ie http://www.mydomain.com/success.php) , replace last line (for sake of cleaning up) with: header("location: $insertgoto");. see if works?


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -