Current location: Hot Scripts Forums » Programming Languages » PHP » refreshing page problem


refreshing page problem

Reply
  #1 (permalink)  
Old 06-17-08, 05:37 AM
zodehala zodehala is offline
Wannabe Coder
 
Join Date: Mar 2007
Posts: 191
Thanks: 0
Thanked 0 Times in 0 Posts
refreshing page problem

when i click the button in form i want page is refreshed auto just one time

(i did it like you see following codes . but it continuous is refreshed . )

PHP Code:

<?php

header
("Content-Type: text/html; charset=windows-1254"); 
echo 
'<link rel="stylesheet" type="text/css" href="style.css">';
echo 
'
    <form name="form1" method="post" action="'
.$_SERVER['PHP_SELF'].'?l=send">
      <label>
      <input type="text" name="textfield" id="textfield">
      </label>
      <label>
      <input type="submit" name="button" id="button" value="Submit">
      </label>
    </form>
'
;

if(
$_POST["l"]="send"){

    
//other table insert codes    
    
    
if(!mysql_query($insert_data)){
        echo 
mysql_errno()."<br/>".mysql_error();    
    }else{
        echo 
"OK";    
        echo 
'
            <script language="javascript">
                window.onload=setTimeout(\'moveTo(window.location.href = "'
.$_SERVER['PHP_SELF'].'")\', 0)
            </script>
        '
;
    } 
}
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-17-08, 05:43 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
Back to the basics: www.php.net/language.operators.comparison


And besides that, you're sending the variable in the action="" attribute of your form, so you have to use $_GET, and not $_POST...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to force a page into an iframe...but? TrueKnight JavaScript 2 02-23-08 03:27 AM
retreived data and display data upon choice from first page? benq PHP 0 05-06-06 06:45 AM
Passing a variable to another page tapir PHP 8 02-16-05 06:38 PM
$_GET variable from previous page! truesilentassassin PHP 6 07-26-04 10:55 PM
PHP/MySQL PAGE LAST UPDATED script problem digioz PHP 2 01-05-04 10:38 AM


All times are GMT -5. The time now is 12:51 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.