Jump to content

tarun

Members
  • Posts

    321
  • Joined

  • Last visited

    Never

Posts posted by tarun

  1. Ive Already Asked For Help About This But...

     

    Heres My New Code

    <?PHP $host = $_SERVER['HTTP_HOST']; ?>
    <?PHP INCLUDE("http://$host/header.php"); ?>
    <DIV CLASS="contentheaderdiv">Home</DIV>
    <DIV CLASS="maincontentdiv">
    Welcome To TPatel<BR>We Hope You Enjoy Our Site
    <?PHP
    if(!isset($changestyle)){
    echo'<BR><BR>Please Choose A Style For The Site:<BR>
    <FORM ACTION="index.php" METHOD="POST">
    <SELECT NAME="changestyle"> 
    <OPTION>Blue</OPTION>
    <OPTION>Green</OPTION>
    <OPTION>Brown</OPTION>
    </SELECT>
    <INPUT TYPE="SUBMIT" VALUE="Change Style">
    </FORM>';
    exit;
    }
    $newstyle = $_POST['changestyle'];
    htmlentities($newstyle);
    if($newstyle ==  Blue)
    {
    setcookie("style", "blue", TIME()+3600);
    echo 'The Style Was Successfully Changed';
    }
    elseif($newstyle ==  Green)
    {
    setcookie("style", "green", TIME()+3600);
    echo 'The Style Was Successfully Changed';
    }
    elseif($newstyle ==  Brown)
    {
    setcookie("style", "brown", TIME()+3600);
    echo 'The Style Was Successfully Changed';
    }
    else
    {
    echo 'The Style Could Not Be Changed';
    }
    ?>
    </DIV>
    <?PHP INCLUDE("http://$host/footer.php"); ?>

     

     

    Why Do I Get This Error When Submitting The Form

    "Warning: Cannot modify header information - headers already sent by (output started at *****/header.php:10) in /home/www/*****/index.php on line 33"

  2. Okay This Is My Code:

     

     

    <?php $host = $_SERVER['HTTP_HOST']; ?>
    <?php INCLUDE("http://$host/header.php"); ?>
    <DIV CLASS="contentheaderdiv">Home</DIV>
    <DIV CLASS="maincontentdiv">
    Welcome To TPatel<BR>We Hope You Enjoy Our Site
    <?php
    if(!isset($changestyle)){
    echo'<BR><BR>Please Choose A Style For The Site:<BR>
    <FORM ACTION="index.php" METHOD="POST">
    <SELECT NAME="changestyle"> 
    <OPTION>Blue</OPTION>
    <OPTION>Green</OPTION>
    <OPTION>Brown</OPTION>
    </SELECT>
    </FORM>';
    exit;
    }
    $newstyle = $_POST['changestyle'];
    htmlentities($newstyle)
    
    if($newstyle ==  Blue)
    {
    setcookie("style", "blue", TIME()+3600);
    echo 'The Style Was Successfully Changed'
    }
    elseif($newstyle ==  Green)
    {
    setcookie("style", "green", TIME()+3600);
    echo 'The Style Was Successfully Changed'
    }
    elseif($newstyle ==  Brown)
    {
    setcookie("style", "brown", TIME()+3600);
    echo 'The Style Was Successfully Changed'
    }
    else
    {
    echo 'The Style Could Not Be Changed'
    }
    ?>
    </DIV>
    <?php INCLUDE("http://$host/footer.php"); ?>

     

     

    But Why Do I Get This Error:

     

    "Parse error: parse error, unexpected T_IF in ****** on line 21"

    (Obviously The Stars Are Just To Hide The Location Of The File)

     

     

    Thnx,

    Tarun

  3. I Cant Find Exactly What's Wrong But

    You Could Mayby Build It Around This

     

    $filename = "text.txt";

    $filecontent = "The Content Of The File"

    $file_pointer1 = fopen("$filename", "w");

    fwrite($file_pointer1, "$filecontent");

    fclose($file_pointer1);

  4. This Is My Basic Layout For My Guestbook

    <CENTER>
    <DIV ALIGN="LEFT"><a href="mailto:">Tarun</a></DIV>
    <DIV ALIGN="RIGHT">10/02/07 | 14:08pm</DIV>
    <DIV ALIGN="LEFT">GUESTBOOK MSG</P>
    </CENTER>

     

    But...

    The Bit Where It Says "10/02/07 | 14:08pm" Is On A New Line

     

    AnyHelp

     

    Thnx,

    Tarun

  5. I Had Help With This Yesturday And Now I Need Some More

    This Is My Example Code

    $friendList = array();
    $friendList["Lisa"] = "offline";
    $friendList["Jack"] = "online";
    $friendList["Ryan"] = "offline";
    $friendList["Rachel"] = "offline";
    $friendList["Grace"] = "online";
    
    foreach( $friendList as $key => $value){
    echo "Friend: $key, Status: $value";
    }

     

    How Would I Change The Values (offline, online etc.)?

     

    Thnx,

    Tarun

  6. Okay Heres My Code

    $friendList;
    $friendList["Lisa"] = "offline";
    $friendList["Jack"] = "online";
    $friendList["Ryan"] = "offline";
    $friendList["Rachel"] = "offline";
    $friendList["Grace"] = "online";
    
    foreach( $friendList as $key => $value){
    echo "Friend: $key, Status: $value";
    }

     

    How Would I Add And Remove Friends?

     

    Thnx,

    Tarun

  7. Personally, i like to have smaller php files that link to each other, like i have header.php, footer.php, menu.php. in this way, when i edit one php file, all the other pages get updated, and this saves both space and time when designing your pages.

    but thats my opinion.

    Ted

     

     

    I Agree This Is A Much Easier Way Of Editing Content Like Navigation Menus

  8. Well Ive Been Looking Around For You And Ive Found This:

    Simple But Does The Job - And It Can Easily Be Changed To Suit Your Needs

    Hope Ive Helped,

    Tarun

     

     

    <style>
    .error {
    color: red;
    display:none;
    }
    </style>
      
    <script>
    function checkForm() {
    user = document.getElementById("user").value;
    pass = document.getElementById("pass").value;
      
    if (user == "") {
    hideAllErrors();
    document.getElementById("userError").style.display = "inline";
    document.getElementById("user").select();
    document.getElementById("user").focus();
    return false;
    }else if (pass == "") {
    hideAllErrors();
    document.getElementById("passError").style.display = "inline";
    document.getElementById("pass").select();
    document.getElementById("pass").focus();
    return false;
    }
    return true;
    }
    
    function hideAllErrors() {
    document.getElementById("userError").style.display = "none"
    document.getElementById("passError").style.display = "none"
    }
    </script>
      
    <form onSubmit="return checkForm();" action='login.php' method='post'>
    Username: <input type='text' name='user'><br>
    <div class='error' id='userError'><br>Required: Please Enter Your Username<br></div><br>
    Password: <input type='password' name='pass'><br>
    <div class='error' id='passError'><br>Required: Please Enter Your Password<br></div><br>
    <input type='submit' name='submit'>
    </form>

  9. I Need Some Help

    I Want To Have A Different Page Title (<title>) Depending On The URL

    Ive Got This But I Know That Its Wrong

    <?PHP
    if $_SERVER['PHP_SELF'] == "index.php"{
    echo "<title>HomePage</title>";
    }
    if $_SERVER['PHP_SELF'] == "chat.php"{
    echo "<title>ChatRoom</title>";
    }
    else{
    echo "<title>PageNotFound</title>"
    }
    ?>

     

    Thnx

     

    Tarun

  10. Ok Thnx

    But Could This Work

    if $_SERVER['PHP_SELF'] == "index.php"{
    echo "<title>HomePage</title>";
    }
    else{
    echo "<title>PageNotFound</title>"
    }
    

    Just Remember Im A Bit Of A Newbie When It Comes To If and ElseIf

     

    Tarun

  11. I Want Some Thing Like

    Say If The Is index.php To Echo <TITLE>Tarun-Home</TITLE>

    And If It Is chat.php To Echo <TITLE>Tarun-Chat</TITLE>

    Im Not Sure How To Do It - Any Ideas?

     

    Thnx

    Tarun

×
×
  • 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.