FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


php link





gerimter
Send and receive data to mysql, data, making the url, how can I redirect to that page?
jmraker
If the page that send and receive data to mysql & data already exists you can redirect to that page by using
Code:
<?php
if(headers_sent()
  echo '<meta http-equiv="refresh" content="0;url=urlToThatPage.php" />
else
  header('Location: urlToThatPage.php');
exit();
?>
gerimter
example, $a=sun $b=page1 text hello .How do I make a link.mysql variable is drawn from
like this http://hello.son.page1
sonam
I am not sure did I good understand your needs but if you want to create link from this two variables then you can do it very simple:

Code:
$link = 'http://hello.' . $a . '.' . $b;
echo $link;


But I don't understand from where you are get text hello;

If you present us your script (or important part) maybe we can help more.

Sonam
gerimter
Thank you very much. To solve problems is great.
sonam
gerimter wrote:
Thank you very much. To solve problems is great.


You are welcome Wink

Sonam
D'Artagnan
jmraker wrote:
If the page that send and receive data to mysql & data already exists you can redirect to that page by using
Code:
<?php
if(headers_sent()
  echo '<meta http-equiv="refresh" content="0;url=urlToThatPage.php" />
else
  header('Location: urlToThatPage.php');
exit();
?>



it works , but if the headers were already sent it will load the page 2 times, one for the meta redirection and one for the page being redirected at, this might seem harmless , but can become a maintenance problem when a debbuging and even a performance problem if this process is done several times.

as a rule of thumb you should never pass the execution to the browser until you are ready so a better approach would be to include your files based on the status in this case it should look something like this:

Code:

#do the dbs check here and make a $isDuplicateOnDb;

if($isDuplicateOnDb){
   include('error_message_duplicate_entry.php');
}else{
   include('sucess_message_is_ok.php');
}



of course it's an oversimplification of what frameworks do on their routers,
gerimter
Thank you very much.
gerimter
When I click on the text, how to create a link?
jmraker
D'Artagnan wrote:
jmraker wrote:
If the page that send and receive data to mysql & data already exists you can redirect to that page by using
Code:
<?php
if(headers_sent())
  echo '<meta http-equiv="refresh" content="0;url=urlToThatPage.php" />';
else
  header('Location: urlToThatPage.php');
exit();
?>



it works , but if the headers were already sent it will load the page 2 times, one for the meta redirection and one for the page being redirected at, this might seem harmless , but can become a maintenance problem when a debbuging and even a performance problem if this process is done several times.


The code is meant to be an example of something you'd place in a function or conditional logic.
Sometimes you need to redirect because if you don't and the form submission added a record, billed them or something you don't want that action repeated if they press F5 to refresh (double bill, or double post). With a location change they can press F5 all they want and they won't accidentally redo a successful form submission.
Related topics
simple php problem, please help...
Build an online dictionary by PHP/MySQL
Adding PHP to My HTML site
Would u be intrested in this? increase your sites PR
HUGE FREE LINK EXCHANGE!!
Php link system
Free Shoutbox Scripts
how do you connect to mysql?
Which is the best Mobile phone
Suppressing mysql error
Teh Music Euphorium
How to create a php files that contain a image ?
Checking server status (ports) using PHP
Active Button With Css And Php...
Image tag with PHP inside help
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.