SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2002
    Location
    Parma-Italy
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Build a search engine and display result!!

    Hi to everybody on the forum,
    I am new in the forum and also new on programming in PHP with mysql.

    The problem I would like to detail now is:

    1) I builded a simple database on mysql with one table.
    I would like to write controls with php which should allow me, giving a title of a film, to display on the same page as a table : the title of film and the options(delete/edit).

    I have two possibilities of searchingne by title ed another by categories of film.
    When I provided the textfield with the title or the category I am looking for, the result should be displayed with on the side the options cancel/edit.

    2) another problem is : I don't know what to put on action form because the codes for action is on the same page.

    see below the codes:
    <html>
    <head>
    <title>Ricerca</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

    <body bgcolor="#FFFFFF" text="#000000">
    <form name="form1" method="post" action="">
    <p>Ricerca per Titoli:
    <input type="text" name="cerca_title">
    <input type="submit" name="Submit_title" value="Cerca">
    </p>
    </form>
    <form name="form2" method="post" action="">
    Ricerca per Genere:
    <input type="text" name="cerca_gen">
    <input type="submit" name="Submit_gen" value="Cerca">
    </form>
    <? // ricerca per titoli
    if( $cerca_title!='')
    {
    $cnx=mysql_connect('localhost','root','mypassword');
    mysql_select_db('ANAGRAFICA VIDEO CASSETTE',$cnx);
    $titoli=mysql_query("Select vid, titolo From video where titolo='$cerca_titolo'");
    }
    ?>

    <Table width="491">
    <TR><TH COLSPAN="5">TITOLI</TH>
    <TH >
    <div align="center">OPZIONI </div>
    </TH>
    </TR>
    <!-- VISUALIZZO I TITOLI CON LE OPZIONI CANCELLA E MODIFICA-->
    <?
    if(!$titoli)
    {
    echo("</Table>");
    echo("<P>nessun titolo trovato in riferimento a $cerca_titolo</P>");
    }
    else
    { if($titoli)
    {
    while($titoli=mysql_query("Select vid, titolo From video where titolo='$cerca_titolo'"))
    {
    echo("<TR>");
    $vid=$titoli["vid"];
    $film=$titoli["titolo"];
    echo("<TD> $film </TD><TD>|<a href='deletetitolo.php?vid=$vid'> Cancella </a> /<a href='edittitolo.php?vid=$vid'>Modifica</a></TD>");
    echo("</TR>\n");

    }
    }
    }

    ?>
    </table>
    </body>
    </html>
    P.S. titolo means title
    genere means category
    modifica is edit
    cancella is delete or cancel

    Thanks in advance, Marcel

  2. #2
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you looking for an example of how to do this, or are you looking for the full thing to be written for you?

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  3. #3
    SitePoint Member
    Join Date
    Feb 2002
    Location
    Parma-Italy
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Seanf for your reply. I have just need an example of how to do it especially how to display all that results on the same page. On different page there's no more problem now.
    Thanks , Marcel


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •