Jump to content

JJ2K

Members
  • Posts

    75
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

JJ2K's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi I have coded a form, and dependant upon the result I would like to re-direct to a different page. The problem is I am getting the "headers already sent" message..Is there a way around this, I can't use JS re-direction because of accessibility. E.G: <?php //Do stuff with form data if($result = y){ header(Location: "mysite.php/thankyou.php"); } else{ header(Location: "mysite.php/error.php"); } ?> In-fact whilst typing this I have an idea, why not do all of this at the top of the page before headers are sent? I'll go ahead and try it now, in the meantime if anybody knows how or if headers can be sent after output please let me know thanks.
  2. Hi, I have a link like this: <a href="myword.php" title="myword">some other text myword blah foo</a> OK now I need to replace myword with newword, but only in the anchor text. So myword in the href or title should not be changed, only matches found inside the anchor text! I tried using str_replace but obviously this just matched all occurances. So I guess preg_replace is the way to go here but it is far too advanced for me and I cannot get my head around all the different symbols. Here is some example code: $html = '<a href="myword.php" title="myword">some other text myword blah foo</a>'; $new = 'newword' $html = preg_replace(//unsure here!); I just don't know how to work regex OT: Did you find it easy/difficult to learn? Thanks to any help
  3. Well couldn't you take the common information out and put them at the top and bottom like: <?php echo "<div id=\"menu_large\">\n"; echo "<ul>\n"; if(strstr($link,'oceandots') && (isset($sub))){ gmv_menu(); echo "<li><a href=\"$link\">$place</a> > </li>\n"; echo "<li>location map</li>\n"; } elseif (strstr($link,'oceandots') && (is_null($sub))){ gmv_menu(); echo "<li>location map</li>\n"; } elseif(strstr($link,'oceandots') === false && (isset($sub))){ echo "<li>$place ></li>\n"; echo "<li>location map</li>\n"; } elseif(strstr($link,'oceandots') === false && (is_null($sub))){ echo "<li>$place ></li>\n"; echo "<li>location map</li>\n"; } echo "</ul>\n"; echo "</div>\n"; echo "</div>\n"; ?> But this is assuming one of the conditions is always met whatever happens? Also your last 2 cases output the same so could you not combine them like: <?php echo "<div id=\"menu_large\">\n"; echo "<ul>\n"; if(strstr($link,'oceandots') && (isset($sub))){ gmv_menu(); echo "<li><a href=\"$link\">$place</a> > </li>\n"; echo "<li>location map</li>\n"; } elseif (strstr($link,'oceandots') && (is_null($sub))){ gmv_menu(); echo "<li>location map</li>\n"; } elseif(strstr($link,'oceandots') === false && ((isset($sub)) || (is_null($sub)) ){ echo "<li>$place ></li>\n"; echo "<li>location map</li>\n"; } echo "</ul>\n"; echo "</div>\n"; echo "</div>\n"; ?> That shortens the exisiting code, but as for the logic I have a feeling it could probably be a bit better. How exactly does this breadcrumb menu work? Why would you be displaying navigation based on the refferer anyhow, unless it was a back button? Why not just display the breadcrumb as it is in your site regardless of where the user has come from? e.g check out the breadcrumb for this particular topic on this site: It will always be this regardless of the refferer.
  4. Sorry not to sure what you mean here?
  5. You need to change 'logged_in' to whatever the name your login script uses It looks as if it's probably using cookies anyhow rather than sessionsbecause you're getting the error because you need session_start(); at the top of the document (but it would have this anyway if it was using sessions).
  6. Like This? if($variable = "somestring"){ if (isset($sub)){ echo "<li><a href=\"$link\">$location</a> > </li>\n"; echo "<li>map</li>\n"; } else{ echo "<li>map</li>\n"; } } If $variable = some string it goes to the if else statement, if not it does nothing.
  7. JJ2K

    blog template

    Yea but anything is up to the designer, really 99% of templates should really be in HTML, but a lot of people wrongly jumped onto using XHTML.
  8. JJ2K

    Center DIV tag?

    Yeah he has this already with his main DIV, he just needs to add position:relative; to #main
  9. Woops sorry I meant change the bouncer to: <?php sesson_start(); print_r($_SESSION); ?>
  10. Hi, Sorry for the delayed response.. Firstly if you change the bouncer to print_t($_SESSION); The log-in, does anything display at all? e.g does it display something like Array ( [userid] => ) ??
  11. JJ2K

    Function

    Yes you are correct it was meant to be a curly brace. What my code is saying is, if there is a paramter in the URL the only display this data for the house in the URL, else there are no paramters in the URL so display the default list of all houses.
  12. Can't you just do something like this: <table width="50" Start off with a small value and then get bigger just to see if it solves the col drop, if not post a link and i'll take a quick look.
  13. JJ2K

    Function

    Yea well can't you just do if($_GET['variablename']){ //Display The House Content } else( //Display the List of Houses }
  14. Yep defo a HTML/CSS problem, just mess around with the table widths
  15. Well can you change bouncer to this temporarlily: echo "session test:".$_SESSION['userid']; Just do some simple debugging!
×
×
  • 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.