ghiz Posted February 14, 2008 Share Posted February 14, 2008 Hi to all, I have an issue with my form not displaying the project values i have a table "opportunities": amount,date_closed, opportunity_projet i have to get all opportunities by project, by date(which is the date between date13 and date14) so, i have 2 pages projet.php (which contains the form) and reslut.php(which displays the result) projet.php <form action="result.php" method="post"> <table width="50%" align="center"> <tr> <td width="34%" height="82" valign="top" nowrap bordercolor="#FFFFFF"> <b class="formulaire">Date1:</b> <p><b class="formulaire">Date2:</b></p> <p><b class="formulaire">Projet:</b></p></td> <td width="66%" height="82" valign="top" nowrap bordercolor="#FFFFFF"> <input type="text" name="date13" <?php if (isset($_POST['date13'])) { echo 'value="' . $_POST['date13'] . '"'; } <input /> ?> /> <p></p> <input type="text" name="date14" <?php if (isset($_POST['date14'])) { echo 'value="' . $_POST['date14'] . '"'; } <input /> ?> /><p></p> <?php $projet=$_POST['projet']; echo"<select name=projet> <option value='Beach' $beach>Beach</option> <option value='Riad' $riad >Riad</option> <option value='Golden Bay' $golden_bay>Golden Bay</option> </select>"; ?> </td> </tr> </table> <table width="50%" align="center"> <tr> <td width="66%" height="14" valign="top" nowrap bordercolor="#FFFFFF"> </td> </tr> <tr> <td width="66%" height="45" valign="top" nowrap bordercolor="#FFFFFF"> <p></p> <p align="center" ><input align="center" type="submit" value="Envoyer" /> </td> </tr></table> </table> </form> </body> </html> reslut.php <html> <head> <title>test</title> <body> <?php mysql_connect("localhost", "toto", "secure"); mysql_select_db("new"); $QueryString = "SELECT opportunity_projet,amount,date_closed FROM opportunities "; if (isset($_POST['date13']) && isset($_POST['date14']) && isset($_POST['projet'])) { $Crt = $_POST['projet']; $date1 = $_POST['date13']; $date2 = $_POST['date14']; $reponse = mysql_query("SELECT opportunity_projet,amount,date_closed FROM opportunities where (date_closed BETWEEN '$date1' AND '$date2')"); $QueryString .= " WHERE opportunity_projet LIKE '%$Crt%'"; while ($donnees = @mysql_fetch_array($reponse) ) { ?> <p><strong> <?php echo $donnees['opportunity_projet']; ?>:</strong><?php echo $donnees['amount']; ?> : <?php echo $donnees['date_closed']; ?></p> <?php } while ($donnees = @mysql_fetch_array($QueryString) ) { echo "this is jus a test"; ?> <p>this is 2nd part</p> <p><strong><?php echo $donnees['opportunity_projet']; ?>:</strong><?php echo $donnees['amount']; ?> : <?php echo $donnees['date_closed']; ?></p> <?php } } ?> <?php mysql_close(); ?> </body> </html> If i run the statement below by itself i get all projects with date between date13 & date 14, so until now it's great But, once i run the statement below it doesn' display any values, so i don't have any clues on how to run it, i'm desperately seeking help while ($donnees = @mysql_fetch_array($reponse) ) thank you in advance Gina Link to comment https://forums.phpfreaks.com/topic/91006-need-help-with-a-form-input/ Share on other sites More sharing options...
cooldude832 Posted February 14, 2008 Share Posted February 14, 2008 all queries need the or die(mysql_error()); added to them to verify they aren't erroring Link to comment https://forums.phpfreaks.com/topic/91006-need-help-with-a-form-input/#findComment-466473 Share on other sites More sharing options...
ghiz Posted February 14, 2008 Author Share Posted February 14, 2008 Actually, I did that still nth happens with the 2nd statement Thanks Gina Link to comment https://forums.phpfreaks.com/topic/91006-need-help-with-a-form-input/#findComment-466486 Share on other sites More sharing options...
trq Posted February 14, 2008 Share Posted February 14, 2008 There is no such html tag as <input />. Replace them with > and you might get valid html. Link to comment https://forums.phpfreaks.com/topic/91006-need-help-with-a-form-input/#findComment-466490 Share on other sites More sharing options...
ghiz Posted February 14, 2008 Author Share Posted February 14, 2008 Hi, The problem is only in this statement $QueryString .= " WHERE opportunity_projet LIKE '%$Crt%'"; thanks Link to comment https://forums.phpfreaks.com/topic/91006-need-help-with-a-form-input/#findComment-466497 Share on other sites More sharing options...
ghiz Posted February 14, 2008 Author Share Posted February 14, 2008 Sorry about the confusion I meant that this statement: while ($donnees = @mysql_fetch_array($QueryString) ) isn't working and not while ($donnees = @mysql_fetch_array($reponse) ) this last is working just fine Sorry again thanks in advance Link to comment https://forums.phpfreaks.com/topic/91006-need-help-with-a-form-input/#findComment-466498 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.