Solved

Meta refresh is redirecting instantly.

Posted on 2008-10-05
1
669 Views
Last Modified: 2013-12-12
Ok my meta refresh is mixxed in with my php files, only way i could get my page to refresh, i am very new to this. So here is all my code. How do i get this to stop, i would like to fill in the feilds, when submited it redirects
<?php require_once('db_connection.php'); ?>

<?php
 

$sql="INSERT INTO tblbasicform (name, email, buissnes_name, location, type)

VALUES

('$_POST[name]','$_POST[email]','$_POST[buissnes_name]','$_POST[location]','$_POST[type]')";
 

if (!mysql_query($sql,$connect))

  {

  die('Error: ' . mysql_error());

  }
 

?>

<html>

<head><meta http-equiv="refresh" content="2;url=updatedelete.php"></head>

<body>
 

Thank you, redirecting now...
 

</body>

</html>
 
 

AND THE PAGE THIS FILE IS CONNECTED TO IS 
 
 
 

<?php
 
 

//db connection

 require_once("includes/db_connection.php"); 

 //end of db connection 

?>

<html>
 

<head> </heaD>

<body>

  

<form name="form" method="post" action="home.php">

	  <input type="hidden" name="redirect" value="home.php"> 

  <table width="418" align="left" cellpadding="0" cellspacing="0">

    <tr>

      <td width="157"> Name:</td>

      <td width="259"><label for="name"></label>

      <input type="text" name="name" id="name"></td>

    </tr>

    <tr>

      <td>Email:</td>

      <td><label for="email"></label>

      <input type="text" name="email" id="email"></td>

    </tr>

    <tr>

      <td>WiFi Business Name:</td>

      <td><label for="buissnes_name"></label>

      <input type="text" name="buissnes_name" id="buissnes_name"></td>

    </tr>

    <tr>

      <td>WiFi Location;</td>

      <td><label for="textfield"></label>

      <input type="text" name="location" id="location"></td>

    </tr>

    <tr>

      <td>Free or Paid:</td>

      <td>

	  <label>Free

        <input type="radio" name="type" id="type" value="free">

        </label>

        <label >Paid

        <input type="radio" name="type" id="type" value="paid"><br />

        </label>	 

		

		

	 <?php 

	   

	   // db table connection

	   include("includes/form.php"); 

	   //end of db table connection 

	

	?>		

							

	  </td>

    </tr>

    <tr>

      <td>&nbsp;</td>

      <td><label for="button"></label>

      <input type="reset" name="button2" id="button2" value="Reset">       

      <label for="sub"></label>

	  <input type="submit" name="button" id="button" value="Submit">

      <label for="button2"></label>

		</td>
 

    </tr>

  </table>

</form>
 

</body>

</html>

<?php mysql_close($connect) ?>

Open in new window

0
Comment
Question by:Lee-Bartlett
1 Comment
 
LVL 5

Accepted Solution

by:
PatrickAdrichem earned 200 total points
ID: 22654481
Meta refresh is designed to Refresh the page,
in your case, the page is refreshed every 2 seconds.
If you want someone to fill in a form and then press submit,
you should remove the refresh completely.

If you want to refresh the page every -x- time untill someone starts
to fill in the forum i'd sugest you use a javascript timer,
which reloads the page, and onfocus of any form element or click on a stop-refresh link. stop the timer.

should be something like attached snipped,
which you add startTimer() onload
and put stopTimer(); in the onfocus=""
<script language="JavaScript">
 

var Timer = null;

var Counter = 4;

var Url = 'updatedelete.php';
 

function startTimer()

{

	Timer = setTimeout("updateTimer()", 1000);

	Counter = 4;
 

function updateTimer() 

{

	Counter = Counter - 1;

	If (Counter < 1)

	{

		clearTimeout(Timer);

		document.location.href = Url;

	}

	else

	{

		Timer = setTimeout("updateTimer()", 1000);

	}

}
 

function stopTimer()

{

	clearTimeout(Timer);

}
 

</script>

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now