I don't understand why I canot $_POST $row[Oras]. I get UNDEFINED VARIABLE
:

<p><?php
     $qorase="SELECT Oras FROM oras";
    if (isset($qorase) && !empty($qorase)) {  
      echo"<!--" . $qorase . "-->";
          $result = mysql_query($qorase)
       or die ("invalid query 4: " . mysql_error ());}
    
    ?>
             <select name="option" >
    
<?php    while ($row = mysql_fetch_array($result)){
    echo "<option value=\"$row[Oras]\">$row[Oras]</option>\n";

       ;}
?></p>
  </select>
</p>

         
<p><input type='submit' name='send'></p>

WHEN I CALL IT WITH POST IS NOT WORKING

$Oras=$_POST[$row['Oras']];

Recommended Answers

All 3 Replies

I don't understand why I canot $_POST $row[Oras]. I get UNDEFINED VARIABLE:

<p><?php
     $qorase="SELECT Oras FROM oras";
    if (isset($qorase) && !empty($qorase)) {  
      echo"<!--" . $qorase . "-->";
          $result = mysql_query($qorase)
       or die ("invalid query 4: " . mysql_error ());}

    ?>
             <select name="option" >

<?php    while ($row = mysql_fetch_array($result)){
    echo "<option value=\"$row[Oras]\">$row[Oras]</option>\n";

       ;}
?></p>
  </select>
</p>


<p><input type='submit' name='send'></p>

WHEN I CALL IT WITH POST IS NOT WORKING

$Oras=$_POST[$row['Oras']];

end quote.

PROBLEM SOLVED:
THE PROBLEM WAS WRONG CALL
the answer found is:

$Oras=$POST['option'];

whenever Your Database is empty at that time you get this error.
Please check your table values.
might be it is empty
if empty then insert value first time manually
i thought it will helpfull to you
because in my case after doing this method my eror are solved ;|)

@harsh_7

Hi, I'm not sure what the OP was trying to do but, in reference to result sets from databases, look at methods like bindColumn():

the variable is initialized and tied to a column name, and will default to NULL if the result set is empty. Counting could also help, see the docs (& the comments for specific cases, like MySQL):

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.