Reputation: 47
I have the following form:
<form id="frmAeroportonew" name="frmAeroportonew" method="post" action="<?php echo $editFormAction; ?>">
<table>
<tr>
<td><input name="iata" type="text" id="iata" value="" /></td>
<td><input name="icao" type="text" id="icao" value="" /></td>
<td><input name="cidade" type="text" id="cidade" value="" /></td>
<td><input name="pais" type="text" id="pais" value="" /></td>
<td><input name="destino" type="checkbox" id="destino" value="" /></td>
<td><input name="alternativo" type="checkbox" id="alternativo" value="" /></td>
<td><input name="h24" type="checkbox" id="h24" value="" /></td>
<td><input name="btnaeroportonew" id="btnaeroportonew" type="submit" value="+" /></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="frmAeroportonew">
The idea is to submit this form, than redirect to another page (teste_redirect.php) appending the input (id=iata) value to the url (teste_redirect.php?iata=input_value).
The PHP code was made in dreamweaver cs6:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frmAeroportonew")) {
$insertSQL = sprintf("INSERT INTO tblaeroportos (iata, icao, cidade, pais, destino, alternativo, H24) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['iata'], "text"),
GetSQLValueString($_POST['icao'], "text"),
GetSQLValueString($_POST['cidade'], "text"),
GetSQLValueString($_POST['pais'], "text"),
GetSQLValueString(isset($_POST['destino']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['alternativo']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['h24']) ? "true" : "", "defined","1","0"));
mysql_select_db($database_connect, $connect);
$Result1 = mysql_query($insertSQL, $connect) or die(mysql_error());
$insertGoTo = "teste_redirect.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
I apreciate all your help. Thankyou
Upvotes: 2
Views: 880
Reputation: 36531
change your insertGoto to
$insertGoTo = "teste_redirect.php?iata=".$_POST['iata'];
Upvotes: 3