Dismiss Notice
You are browsing this site as a guest. It takes 2 minutes to CREATE AN ACCOUNT and less than 1 minute to LOGIN

kwa wanaofahamu PHP tusaidiane hapa

Discussion in 'Tech, Gadgets & Science Forum' started by MAHENDEKA, Jun 9, 2011.

  1. MAHENDEKA

    MAHENDEKA Senior Member

    #1
    Jun 9, 2011
    Joined: Jul 9, 2010
    Messages: 188
    Likes Received: 12
    Trophy Points: 35
    p { margin-bottom: 0.08in; }



    Nimeshindwa kuondoa hili tatizo,kila napojaribu kurun code hizi kwa kutumia Mozilla firefox Napata hii meseji

    Warning: Cannot modify header information - headers already sent by (output started at c:\wamp\www\majaribio\fomu1.php:8) in c:\wamp\www\majaribio\fomu1.php on line 24


    (-line 24 ndo nimeibold hapo chini )
    Nmejaribu kuondoa echo statements zote na blank spaces zilizopo ndani ya opening and closing php tags lakini tatizo bado lipo pale pale
    Kwa wanaofahamu vizuri PHP tusaidiane hapa, pamoja na maelezo kidogo
    <html>
    <head>
    <title>
    </title>
    </head>
    <body>
    <?
    $host = "localhost";
    $user = "root";
    $password = "";
    $db = "juasun";
    mysql_connect($host,$user,$password,$db) or die (mysql_error());
    mysql_select_db($db) or die (mysql_error());
    $suzi = "insert into values ('".$_POST['user']."','".$_POST['pass']."') ";
    $result=mysql_query($suzi);
    if(!$result)
    {
    echo'you cant insert into the database....';
    }
    else
    {
    header('location:fomu2.php');
    }


    ?>
    <h2>firs t form</h2>
    <form method = POST action="fomu1.php">
    NAME:
    <input name="user" type="text" maxlength="20" size="20" >
    <br>
    PASSWORD:
    <input name="pass" type="password" maxlength="20" size="20" >
    <input type="submit" value="save">
    </form>


    </body>
    </html>
     
  2. redSilverDog

    redSilverDog JF-Expert Member

    #2
    Jun 9, 2011
    Joined: Sep 18, 2010
    Messages: 486
    Likes Received: 3
    Trophy Points: 0
    sijaipata hio error, lakini jaribu kueka hio php code before <head> au before <html> kabisaa...
     
  3. Kang

    Kang JF-Expert Member

    #3
    Jun 9, 2011
    Joined: Jun 24, 2008
    Messages: 4,698
    Likes Received: 203
    Trophy Points: 160
    header inabidi iwe kabla ya output yoyote.

    PHP: header - Manual
     
  4. MAHENDEKA

    MAHENDEKA Senior Member

    #4
    Jun 9, 2011
    Joined: Jul 9, 2010
    Messages: 188
    Likes Received: 12
    Trophy Points: 35
    nashukuru kwa maelezo yako kang,nimejaribu kuondoa,blank spaces pamoja na echo statements lakini tatizo bado lipo pale pale..sa sijui mimi ndo naelewa vibaya au vipi,au ungenisaidia output ambayo inakuwa sent kwenye browser kabla ya header ipo wapi au line ipi ?
     
  5. redSilverDog

    redSilverDog JF-Expert Member

    #5
    Jun 9, 2011
    Joined: Sep 18, 2010
    Messages: 486
    Likes Received: 3
    Trophy Points: 0
    hio ulioeka bold na kwa maandishi makubwa!
     
  6. Kang

    Kang JF-Expert Member

    #6
    Jun 9, 2011
    Joined: Jun 24, 2008
    Messages: 4,698
    Likes Received: 203
    Trophy Points: 160
    Hizi zote

    Re-write hivi ili header iwe kabla ya output yoyote.
    PHP:
    <?
    $host "localhost";
    $user "root";
    $password "";
    $db "juasun";
    mysql_connect($host,$user,$password,$db) or die (mysql_error());
    mysql_select_db($db) or die (mysql_error());
    $suzi "insert into values ('".$_POST['user']."','".$_POST['pass']."') ";
    $result=mysql_query($suzi);
    if(!
    $result)
    {
    echo
    'you cant insert into the database....';
    }
    else
    {
    header('location:fomu2.php');
    exit;
    }

    ?>
    <html>
    <head>
    <title>
    </title>
    </head>
    <body>
    <h2>firs t form</h2>
    <form method = POST action="fomu1.php">
    NAME:
    <input name="user" type="text" maxlength="20" size="20" >
    <br>
    PASSWORD:
    <input name="pass" type="password" maxlength="20" size="20" >
    <input type="submit" value="save">
    </form>


    </body>
    </html>

     
  7. MAHENDEKA

    MAHENDEKA Senior Member

    #7
    Jun 10, 2011
    Joined: Jul 9, 2010
    Messages: 188
    Likes Received: 12
    Trophy Points: 35
    asante mkuu,nmefanikiwa kutatua tatizo,nkipatwa na tatizo tena ntarudi
     
Loading...