LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Reloading page with php (https://www.linuxquestions.org/questions/programming-9/reloading-page-with-php-227705/)

emilioestevezz 09-07-2004 09:53 AM

Reloading page with php
 
Hi, i´ve got a flash form that send inserted data to a
page called insert.php and after sending data to the
mysql database the page reloads the flash form for a
new entry, but it reloads it on a new page i want to
reloadit on the same page that i ´ve enter the
previous entry. I´m posting the relevant parts of the
php code:

<?php

//defino variables
$apellidoclientesnuevos = $_POST['apellido'];
$nombreclientesnuevos = $_POST['nombre'];
$telefonoclientesnuevos = $_POST['telefono'];
$dniclientesnuevos = $_POST['dni'];
$fechacitaclientesnuevos = $_POST['fecha'];
$horacitaclientesnuevos = $_POST['hora'];
$abogadoclientesnuevos = $_POST['abogado'];
$asuntoclientesnuevos = $_POST['asunto'];
$dondeclientesnuevos = $_POST['donde'];
$URL="http://www.myform.php";

//establece conección con el servidor y abre la base
de datos

$db = mysql_connect("90.0.0.2", "javier", "315/95");

mysql_select_db("clientes",$db);

//manda query a la base de datos

$sql = "INSERT INTO clientesnuevos (1,2,3,4,5,6)
VALUES ('$1','$2','$3','$4','$5','$6')";
$result = mysql_query($sql) or die("Error in query: "
. mysql_error());

header ("Location: $URL");
exit;
?>

Any idea how can i do this??

Thanks
emilio

druuna 09-07-2004 04:40 PM

This should work. Replce it with your header line and remove the URL set line..

$url = $_SERVER['SERVER_NAME'];
$path = $_SERVER['PHP_SELF'];
header("Location: http://$url$path");


Hope this helps.


All times are GMT -5. The time now is 01:01 AM.