SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2011
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy selecting different data and opening different pages..

    <?php
    $con = mysql_connect("localhost","222","ade");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
    ?>
    <html>
    <head>
    <title>detail report</title>
    <style type="text/css">
    TD(color:#003500;font-family:verdana)
    TH(color:#ff0000; font-family:verdana; bgcolor="#336600")
    </style>
    </head>
    <body bgcolor="DarkOliveGreen " foreground color="blue">

    <form action="org3.php" method="post">
    <table border="3" cellpadding="10" cellspacing="5" bgcolor="#353536" align="center">


    <tr>
    <td bgcolor ="#ffffff" width="50%">STARTING DATE</td>
    <td bgcolor ="#ffffff" width="50%">
    <select name="st_date" style="width:150px">
    <option value="" selected> select st_date...</option>
    <option value="2001-01-01">2001-01-01</option>
    <option value="2001-04-01">2001-04-01</option>
    <option value="2002-01-01">2002-01-01</option>
    <option value="2002-02-01">2002-02-01</option>
    <option value="2004-01-01">2004-01-01</option>
    <option value="other">other....</option><br></br>
    </select>
    </td>
    </tr>

    <tr>
    <td bgcolor ="#ffffff" width="50%">END DATE</td>
    <td bgcolor ="#ffffff" width="50%">
    <select name="rduration" style="width:150px">
    <option value="" selected> select end date...</option>
    <option value="2003-01-01">2003-01-01</option>
    <option value="2003-04-01">2003-04-01</option>
    <option value="2004-01-01">2004-01-01</option>
    <option value="2004-02-01">2004-02-01</option>
    <option value="2005-05-01">2005-05-01</option>
    <option value="2008-01-01">2008-01-01</option>
    <option value="other">other....</option>

    </select>
    </td>
    </tr>

    <tr>
    <td bgcolor ="#ffffff" width="50%"> UC REPORT </td>
    <td bgcolor ="#ffffff" width="50%">
    <input type="radio" name="type" value="recieved" checked>recieved <br>
    <input type="radio" name="type" value="not recieved"> not recieved <br>
    <input type="radio" name="type" value="both">both<br>
    </td>
    </tr>

    <tr>
    <td bgcolor="#ffcc00" colspan="20" align="center">
    <input type="submit" name="SUBMIT" value="submit" >
    </td>
    </tr>
    </form>

    </body>
    </html>




    this is my org3.php page:-

    <?php
    $con = mysql_connect("localhost","abc","abc");
    if (!$con)
    {
    die('Could not connect: ' . mysql_error());
    }
    mysql_select_db('organisation' , $con);

    $query = "SELECT id, name, orgname, duration, cost FROM org1 WHERE st_date = '2001-01-01' and end_date='2003-01-01'";

    $results = mysql_query($query);
    ?>
    <html>
    <head>
    <title> report list</title>
    </head>
    <body bgcolor="AliceBlue ">
    <p style="background: yellow; color: purple">

    <h2><center> REVIEW OF REPORTLIST</center></h2>
    <table width="70%" border="1" cellpadding="2" cellspacing="2" align="center">
    <tr>
    <td width="30%"><b>Report id</b></td>
    <td width="30%"><b>Report Name</b></td>
    <td width="30%"><b>Organisation Name</b></td>
    <td width="20%"><b>Report Duration</b></td>
    <td width="20%"><b>Cost of Project</b></td>
    </tr>
    </p>

    <?php
    while ($row = mysql_fetch_array($results))
    {
    extract($row);
    echo "<tr><td width=\"30%\">";
    echo $id;
    echo "</td><td width=\"30%\">";
    echo $name;
    echo "</td><td width=\"30%\">";
    echo $orgname;
    echo "</td><td width=\"20%\">";
    echo $duration;
    echo "</td><td width=\"20%\">";
    echo $cost;
    echo "</td></tr>";
    echo "<br>";

    }
    mysql_close($con);
    ?>
    </table>
    </body>
    </html>

    my this program is very much simple and static i.e
    when i enter start date -2001-01-01and end date -2003-01-01,it show me a page which i hv linked with mysql database and when i click on other date then also it show mein same page that i hv clicked earlier or if i don't enter any start date or end date it len also link to same page which i have enter for start date-2001-01-10 and end date 2003-01-01..

    i want to make my this page dyanamic i.e when i enter different start date and end date it should show me different other pages or link not the same pages...

    plz help me or modify my this program.......it is the main part of my project and website....urgent

  2. #2
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,397
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Those dates will always be used, see the line which says:

    PHP Code:
    $query "SELECT id, name, orgname, duration, cost FROM org1 WHERE st_date = '2001-01-01' and end_date='2003-01-01'"
    Nowhere in your code do you read the values that were sent along in the form, nor do you put those values into the query above.

    Have you worked with reading/using form values before, or writing dynamic MySQL queries?
    Salathe
    Software Developer and PHP Manual Author.

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2011
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Salathe View Post
    Those dates will always be used, see the line which says:

    PHP Code:
    $query "SELECT id, name, orgname, duration, cost FROM org1 WHERE st_date = '2001-01-01' and end_date='2003-01-01'"
    Nowhere in your code do you read the values that were sent along in the form, nor do you put those values into the query above.

    Have you worked with reading/using form values before, or writing dynamic MySQL queries?
    i have been working first time with php and mysql thats why i am having difficulties...even i can't hire a proffessionist becoz i am living in a hostel where i can't hire any one..

  4. #4
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tamanna View Post
    i have been working first time with php and mysql thats why i am having difficulties...
    Perhaps start on a smaller project before tackling a project like this one.

    A good place to start could be the w3schools php/mysql tutorials

  5. #5
    SitePoint Enthusiast
    Join Date
    Aug 2011
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by webdev1958 View Post
    Perhaps start on a smaller project before tackling a project like this one.

    A good place to start could be the w3schools php/mysql tutorials
    i have been practicing for last two month from this site and complete reference of mysql and beginning with php5,apache,mysql web development book. but i am having little problem in making a dynamic page..

    thats why i wrote my query..

    my all the threads have been solved...

    plz help me to solve this query also...


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
  •