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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.