Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1

    Default PHP help again :D


    Gud afternoon! Ako ay nagbabalik nahuman naku ako tutorial sa PHP and MYSQL("Thank God") and karon nagbuhat ko ug a simple Student Information System kay murag kana ako nahuna2.an as practice sa ako gstudyhan simple lang na approach ako gina buhat like add student, search , delete , edit , and view. na buhat na nku ang add, search, view wala pa ang uban.. ang problema nku karon once na magsearch ko tapos mu balik ko ug home then sa pagbalik nku ug search npud naa pa ang previous result. ako g try ug SESSION ang ka2ng g keyword para e destroy lang kung maghawa sa page pero naa siyay error ana, also naa pud 2 error basta dili pa ko magsearch about a2ng index sa POST pero kung maka search nku ma wala ra man adik kaau. unsa mga possible na solution for this problem mga master.. kabalo ko na ma search ra ni sa google pero mas ok kung sainu gkan kay mga master bia mu and also daghan pa man gud ko mga further question and clarification about sa PHP/MYSQL.. so, kani lang sa..

    Thank you daan!
    God Bless as all!

  2. #2

    Default Re: PHP help again :D

    too vague haha, mas maayo pa idescribe ug tarong

    God Bless

  3. #3

    Default Re: PHP help again :D

    ang pina ka nindot nga searching technique is mag AJAX ka... base lang pd na sakong ma suggest nmo naay dghang styles pero nindot ang AJAX kay dynamic.... bali ang prob nmo is mag search ka then mo transfer kag lain link then mo balik ka naa japon imong query basin saup imong na link nga nabutang... dunno ha try to explore searching using AJAX sir simple rajud xa... copy paste rang codes except sa queries nmo.

  4. #4

    Default Re: PHP help again :D

    Quote Originally Posted by -_- View Post
    too vague haha, mas maayo pa idescribe ug tarong

    God Bless
    ahaha! too vague bitaw masking ako kung balikon ug basa kung wala kay idea ma libug ka.. salamat! ehehe!

  5. #5

    Default Re: PHP help again :D

    sakto sir kung magtransfer ko sa lain link tapos mu balik npud ko ug search naa 2 ako previous na g search, gus2 tana nku wala na 2 siya.. (AJAX) unya na basin ko mag.ambak sa lain na topic sir. e set aside nlang sa 2 nku na problema.. mag explore sa ko ug maau sa PHP.. dili pa pud kaau ko kabalo ug javascript next mission pa nku na.. Salamat kaau sa imu idea dili nku kalimtan.. ehehe!
    pero kung naa ka code sample sa search ayaw lang nang AJAX dili nku ma sabtan..

    Thank you sainu!
    Godbless!

  6. #6

    Default Re: PHP help again :D

    pwede nmo ma post imong code, kadto naay PHP lng?

    btw, try daw e initialize imong variable g handle sa search if gi inani nimo.
    on top of page.

    $_SESSION['imong_variable'] = '';

  7. #7

    Default Re: PHP help again :D

    gtry nku ang $_SESSION boss pero nag error siya ,dili pa jud mu search adik kaau. Pero ka2ng POST mu search siya pero naa ghpon error..

    "Notice: Undefined index: keyword in C:\xampp\htdocs\Tutorial\Own\SIS\search_form.php on line 106"

    mao ni ako code: Beginner ra ko

    </style>
    </head>
    <body>
    <div id="wrapper">
    <div id="header"><div id="header"><img src="images/SISlgo_01.gif"/></div></div>
    <div id="reg">
    <form method="POST" action="search_form.php">
    <table>
    <ul>
    <li class="text">Enter Search Keyword</li>
    <li><input type="text" name="keyword"/></li>
    <li><input type="submit" value="Search"/></li>
    </ul><br>
    <tr style="background: #666666; color: #ffffff;">
    <td>Student #</td>
    <td>Student Name</td>
    <td>Birthday</td>
    <td>Course/Year</td>
    <td>E-mail</td>
    <td>Contact #</td>
    <td></td>
    </tr>
    <?php
    $search = $_POST['keyword'];
    $flag = 0;
    $sqlQuery = "SELECT * FROM student WHERE stud_id LIKE '%$search%' or firstname LIKE '%$search%' or lastname LIKE '%$search%'";
    $result = mysql_query($sqlQuery);
    while($row = mysql_fetch_array($result))
    {
    $flag = 1;
    echo "<tr>";
    echo "<td>".$row[0]."</td>"." ";
    echo "<td>".$row[5].",".$row[3]." ".$row[4]."</td>"." ";
    echo "<td>".$row[6]."</td>";
    echo "<td>".$row[7]."/".$row[8]."</td>";
    echo "<td>".$row[11]."</td>";
    echo '<td><a href="edit.php?id=' . $row[0] . '">Edit |</a><a href="delete.php?id=' . $row[0] . '"> Delete</a>\'</td>';

    echo "</tr><br>";
    }
    if($flag==0)
    {
    echo "<tr><td colspan='3' align='center' style='color:red;'>Record not found</td></tr>";
    }

    ?>
    </table>
    </form>
    </div>
    <div id="button">
    <span><a href="home.html"><img src="images/icon_12.gif"/></a></span>
    <span id="right"><a href="home.html"><img src="images/icon_13.gif"/></a></span>
    </div>
    <div id="footer">
    <p>Proposed Project by A Beautiful Affair.<br>October 26, 2012</p>
    </div>
    </div>
    </body>
    </html>


    Salamat sainu!

  8. #8

    Default Re: PHP help again :D

    Hello Brader,

    This error:
    PHP Code:
    "Notice: Undefined index: keyword in C:\xampp\htdocs\Tutorial\Own\SIS\search_form.php on line 106" 
    Refers to this line of code:
    PHP Code:
    $search $_POST['keyword']; 
    Sa first page load wala pa ma set ang $_POST['keyword'] kay wala pmn ma submit ang form. Bali you're trying to store non-existent data to $search. Ang solution ana is simple, use isset().

    PHP Code:
    if( isset($_POST['keyword'] ) {
        
    $search $_POST['keyword'];

    bale i-check sah niya kung naa bay value ang variable before niya i-assign to $search.

    From PHP manual:
    Returns TRUE if var exists and has value other than NULL, FALSE otherwise.
    Also, side note lng brader. Sanitize your inputs. Placing variables directly into your SQL queries, is one web development's biggest no-noes since this opens you up to SQL injection and, in effect, other conventional hacks.
    It's OK to use these now, since you are only testing and you are on a local machine. Pero please remember that once you put this out to the world, the box that you use to host your site will be open to one of the easiest hacking methods available.

    Read this article for some healthy practices.

    Good luck.

  9. #9

    Default Re: PHP help again :D

    very broad

  10. #10

    Default Re: PHP help again :D

    try this:
    $search = isset($_POST['keyword']) ? $_POST['keyword'] : "";

    to debug(after saimong $sqlQuery) pra kabalo ka unsy itsura asimong QUery statement:
    if(!empty($_POST['keyword'])){
    echo $sqlQuery;
    exit();
    }
    Last edited by ondoy; 10-30-2012 at 09:34 AM.

  11.    Advertisement

Page 1 of 2 12 LastLast

Similar Threads

 
  1. Im learning PHP, Help me hw to run the PHP!
    By kyme in forum Programming
    Replies: 23
    Last Post: 08-21-2012, 02:57 AM
  2. Replies: 33
    Last Post: 10-17-2008, 04:09 PM
  3. Streaming/Playing videos in PHP..help.
    By ichiriki in forum Programming
    Replies: 3
    Last Post: 10-08-2008, 05:15 PM
  4. PHP help me
    By poymode in forum Programming
    Replies: 8
    Last Post: 07-28-2007, 02:57 PM
  5. PHP help
    By tjyrna in forum Networking & Internet
    Replies: 1
    Last Post: 07-06-2006, 11:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top