php - URL redirection after form submitted without inherited params -


i working on web site using php , jquery mobile. on page have form:

 <form method="post" name="form1" id="form1" onsubmit="return comprobardatos()" data-ajax="false" action="<?php echo $editformaction; ?>"> <p>    nombre:     <input type="text" name="nombre_plato" id="nombre_plato"  value="" size="32" > <div id="mensajealias"></div><div id="ajaxbusy" style="display: none;"><p><img src="wait.gif"></p></div>   </p> <p>descripción:   <input type="text" name="descripcion_plato" id="descripción_plato" value=""  size="32"><div id="mensajenombre"></div>   </p>  <p>precio 1:   <input type="text" name="precio1_plato"  value="" onkeypress="if ( isnan(this.value + string.fromcharcode(event.keycode) )) return false;" size="32">   </p>   <p>precio 2:   <input type="text" name="precio2_plato"  value="" onkeypress="if ( isnan(this.value + string.fromcharcode(event.keycode) )) return false;" size="32">   </p>   <p>precio 3:   <input type="text" name="precio3_plato"  value="" onkeypress="if ( isnan(this.value + string.fromcharcode(event.keycode) )) return false;" size="32">   </p>   <p>precio 4:   <input type="text" name="precio4_plato"  value="" onkeypress="if ( isnan(this.value + string.fromcharcode(event.keycode) )) return false;" size="32">   </p>  <p>   <input type="button" name="clear" data-role="button" data-theme="e" value="limpiar formulario" onclick="clearform(this.form);">   <div id="boton"><input type="submit" data-role="button" data-theme="b"id="insertar" value="insertar nuevo contenido de la carta" ></div><div id="mensajeboton"></div> </p> <p>           <input type="hidden" name="cadena_plato" value="<?php echo $_session[region]?>">            <input type="hidden" name="restaurante_plato" value="<?php echo $_get['rest']?>">            <input type="hidden" name="categoria_plato" id="categoria_plato" value="<?php echo $_get['cat']?>">                 <input type="hidden" name="mm_insert" value="form1">               </p>              </form> 

the url page is:

http://.../nuevoadminplato.php?rest=1&cat=9 

when user clicks on submit button, page adminplatos.php should shown. part of code using go page>

$insertgoto = "adminplatos.php";   if (isset($_server['query_string'])) {     $insertgoto .= (strpos($insertgoto, '?')) ? "&" : "?";     $insertgoto .= $_server['query_string'];   }   header(sprintf("location: %s", $insertgoto)); } 

but launched url is?

http://.../adminplatos.php?rest=1&cat=9 

and don't want there params> rest=1&cat=9

i guess jquery issue, don't know how avoid it.

so, here have complete block of code...

$insertgoto = "adminplatos.php"; if(!empty($_post['cat'])) {   $insertgoto .= '?id=something';   $insertgoto .= '&cat='.$_post['cat'];   header("location: $insertgoto"); } 

i used !empty($_post['cat']), because going use 'cat' , !empty() better fit isset(), because 'cat' empty, isset() wtill return true;

then used header("location: $insertgoto");, because have single 1 variable , should more clear read.


Comments

Popular posts from this blog

c# - ReportViewer control - axd url -

c# - must be a non-abstract type with a public parameterless constructor in redis -