Hello...
I had posted the following in correctly in javascript forum...
----------------------------------------------------------
To understand the problem, please visit my website,
On the polling form (which by the way is a separate html, displayed via the <iframe> tag), when the user completes the form and selects "Submit", the DB insert (via load.php) works fine, but the page changes to different target.
How can I make the page return to the original page with a blank form?
the form html file can be viewed at:
Thanks,
Arun
----------------------------------------------------------
To which i received the reply....
<?php
/* ... all current load.php code ... */
header('Location:
?>
Note : you must not output content before the header() call.
----------------------------------------------------------
The following is my script. You can see the header() call in the beginning. This accomplishes what i am looking to do. However, The 2 messages from script do not display. Help is appreciated...
Thanks,
Arun
------------------------------------------------------------
<?php
header('Location: $con = mysql_connect("localhost","bccicom","arunraj1");
$table = survey_001;
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db(bccicom_BCCI);
$sql="INSERT INTO $table (Email, Country, Choice)
VALUES ('$_POST', '$_POST[Country]', '$_POST[Choice]')";
$query = "SELECT Email FROM $table WHERE Email = '$_POST[Email]'";
$result = mysql_query($query);
if (mysql_num_rows($result) > 0)
{
echo "<script>alert('You have already voted for this opinion poll')</script>";
die ();
}
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "<script>alert('Thank you for voting!! Results update periodially!')</script>";
mysql_close($con);
?>
I had posted the following in correctly in javascript forum...
----------------------------------------------------------
To understand the problem, please visit my website,
On the polling form (which by the way is a separate html, displayed via the <iframe> tag), when the user completes the form and selects "Submit", the DB insert (via load.php) works fine, but the page changes to different target.
How can I make the page return to the original page with a blank form?
the form html file can be viewed at:
Thanks,
Arun
----------------------------------------------------------
To which i received the reply....
<?php
/* ... all current load.php code ... */
header('Location:
?>
Note : you must not output content before the header() call.
----------------------------------------------------------
The following is my script. You can see the header() call in the beginning. This accomplishes what i am looking to do. However, The 2 messages from script do not display. Help is appreciated...
Thanks,
Arun
------------------------------------------------------------
<?php
header('Location: $con = mysql_connect("localhost","bccicom","arunraj1");
$table = survey_001;
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db(bccicom_BCCI);
$sql="INSERT INTO $table (Email, Country, Choice)
VALUES ('$_POST', '$_POST[Country]', '$_POST[Choice]')";
$query = "SELECT Email FROM $table WHERE Email = '$_POST[Email]'";
$result = mysql_query($query);
if (mysql_num_rows($result) > 0)
{
echo "<script>alert('You have already voted for this opinion poll')</script>";
die ();
}
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "<script>alert('Thank you for voting!! Results update periodially!')</script>";
mysql_close($con);
?>