morning i have an issue and need help. i have a page that retrieve the information entered on a form every time you hit the button submit. the page display all the field form that was entered except from one which is a radio radio buton and give me that error:
Notice: Undefined index: Du in C:\wamp\www\exercise\confirmation.php on line 153. can't figure our what's happening
here is my code:

<html>
<head>
<link href="insert.css" rel="stylesheet">
</head>

<body>

<h1><CENTER>Page de confirmation des donnees </CENTER></h1>

<p style = "font-family:Times New Roman; font-size: 20px; font-weight:bold; color:BLACK; text-align:center"> Merci d'avoir rempli ce formulaire</p>


<br/><br/>
<center>
<p style = "font-family:Times New Roman; font-size: 18px; font-weight:bold; color:BLACK; text-align:center">Voici les informations que vous avez entre</p>
<table style="width:50%">
  <tr>

                        <td>
                        <center>
                        <?php
                        echo "<strong>Nom :</strong>".$_POST["nom"];
                        ?>
                        </center>
                        </td>


                                <td>
                                <center>
                                <?php
                                echo "<strong>Prenom(s):</strong>" .$_POST["prenom"];
                                ?>
                                </center>
                                </td>        

  </tr>
</table>

<br/>
<table style="width:50%">
  <tr>
                          <td>
                          <center>
                          <?php
                                echo   "<strong>Telephone1:</strong>"  .$_POST["Telephone1"]; 
                          ?>
                          </center>
                          </td>


                            <td>
                            <center>
                            <?php
                                echo "<strong>Telephone2:</strong>"  .$_POST["Telephone2"];   
                            ?>
                            </center>
                            </td>


                            <td>
                            <center>
                            <?php
                            echo "<strong>Telephone3:</strong>"  .$_POST["Telephone3"];   
                            ?>
                            </center>
                            </td>
    </tr>
    </table>

   <br/> 
  <table style="width:50%">
  <tr>
                        <td>
                        <center>
                        <?php
                                echo "<strong>Email1:</strong>"  .$_POST["Email1"];   
                        ?>
                        </center>
                        </td>



                        <td>
                        <center>
                        <?php
                                echo "<strong>Email2:</strong>"  .$_POST["Email2"];       
                        ?>
                        </center>
                        </td>



                            <td>
                            <center>
                            <?php
                                echo "<strong>Email3:</strong>"  .$_POST["Email3"];   
                            ?>
                            </center>
                            </td>

    </tr>
    </table> 

    <br/>
     <table style="width:50%">
  <tr>
                            <td>
                            <center>
                            <?php
                                    echo "<strong>Sexe:</strong>" .$_POST["Sexe"];    
                            ?>
                            </center>
                            </td> 
    </tr>
    </table>

    <br/>
    <table style="width:50%">
  <tr>
                        <td>
                        <center>
                        <?php
                                 echo "<strong>Pays de residence:</strong>"  .$_POST["pays"];
                        ?>
                        </center>
                        </td> 
  </tr>
    </table>

    <br/>
    <table style="width:50%">
  <tr>
                        <td>
                        <center>
                        <?php
                                echo "<strong>Ville:</strong>" .$_POST["ville"];  
                        ?>
                        </center>
                        </td> 
  </tr>
    </table>


    <br/>
    <table style="width:50%">
  <tr>
                        <td>
                        <center>

                        <?php 
                        if(isset($_POST['submit']))
                        {
                            echo "<strong>Duree du sejour:</strong>" .$_POST["Du"];
                        }   
                        ?>

                        </center>
                        </td> 
  </tr>
    </table>

                        <input class="submit" name="submit" type="submit" value="Enregistrer">

</center>


</body>
</html>

``

its not error, its warning,
YOu can disable warning in your php.ini configuration file and restart apache service

Make sure following line is off instead of on

display_errors = Off

do not turn off warnings, fix the code

fix1:
<?php if(isset($_POST['Du'])) {echo "<strong>Duree du sejour:</strong>" .$_POST["Du"];} ?>
replaces 150-156
Its always better to check the right variable, submit does not ensure a value was set to Du

fix2:
assign a default value selected='selected' to one radio button option

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.