Jump to content

Recommended Posts

im creating a CMS and i want im using a $_GET variable for each page and all the code is in one file.

once they click the save button in the CMS i want it to insert the data into the database(which ive already finished) but i want them to go to an "Update Success" page after they click save. I want each page to go to the same "header()"

Link to comment
https://forums.phpfreaks.com/topic/70691-multiple-header/#findComment-355354
Share on other sites

Thorpe has a valid point here, and the header() function sends raw header data to the browser for its uses.  Such as a 404 for a page not found error.  This is useful in multiple ways.

1) send errors like 404

2) send header(location: page.php); to redirect

3) send data about what the document type is.  This is key in a lot of cases as you don't want the default xhtml doc type sent

4) Send detailed info about the page (Such as a pdf for download vs in browser display)

 

and many more as explained here

http://us.php.net/manual/en/function.header.php

 

you can send multiple headers, if they make sense, but  I don't think your using the term right as thrope suggested

Link to comment
https://forums.phpfreaks.com/topic/70691-multiple-header/#findComment-356150
Share on other sites

<?php
  function location()
  {
      header('Location:http://www.yoursite.com/somepage.php');
  }
?>

 

and anytime you wanna use it just call it....

 

<?php location(); ?>

 

and you cannot use a header-location more than once on a page because the first time the script hits the header(); it will redirect and your no longer on that page.

 

I guess this saves a little typing .... but not much..

Link to comment
https://forums.phpfreaks.com/topic/70691-multiple-header/#findComment-356994
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.