Jump to content


Photo

page redirect


  • Please log in to reply
3 replies to this topic

#1 therock

therock
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 06 September 2006 - 07:40 AM

hi all,
i'm new to this forum awa to php.

can someone help me
i want to redirect to some other php page on a button click.

i used this code, but it doesn't work

$URL="http://www.example.com";

header ("Location: $URL");

is there anythin like redirect("");

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 06 September 2006 - 07:48 AM

So why not use html .... <a href="http://www.example.com">click here</a>
Legend has it that reading the manual never killed anyone.
My site

#3 therock

therock
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 06 September 2006 - 08:26 AM

hi andy,
i'm gettin datas from users usin a form(getdata.php) and insertin it into a table(insertdata.php).

wen datas r inserted the page (insertdata.php) remains.

wat i need is to redirect it to (getdata.php) again after insertion is over.


#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 06 September 2006 - 08:38 AM

As long as you have no output to the browser in insertdata,php, you can use the header() function:

<?php
// insertdata.php

// retrieve data from form
// conn to database, select database
// create and execute db query

header("Location: getdata.php");
?>

Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users