Jump to content

need help with a form input


ghiz

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.