Jump to content

create some formualrs with php - problem with select-field


DaMaxl

Recommended Posts

Hi guys,
sorry...i'm a newbiiii and actually not that firm with php.
i create some formualrs using while loop.
the forms and input fields receives their names including a variable out of the database.

by submitting to another page almost all values are transmitted except the value of the select field.

I'm acutally using that ( it's just a shortcut ):

 


<form id='contact-form".$KitchConfigID."' name='contact-form".$KitchConfigID."' action='_pages/_kitchenconfig/adm_saveKitchConfig.php?Nav=".$NavHash."&kcid=".$KitchConfigID."' method='POST'>
  
  <div class='row'>

    <div class='col-sm-12'>
      <div class='md-form mb-0 form-sm'>
        <input value='".$KitchConfig."' type='text' id='configname".$KitchConfigID."' name='configname".$KitchConfigID ."' class='form-control'>
        <label for='configname".$KitchConfigID ."' class=''>Config Name:</label>
      </div>
    </div>

  </div>

  <div class='row'>
    <div class='col-sm-12'>
      <div class='md-form mb-0 form-sm'>
        <select id='designer_".$KitchConfigID."' name='designer_".$KitchConfigID."' class='mdb-select md-form' searchable='Search here..' onchange='changeInput(this.value, ".$SelField.");'>");
          $designersql = "SELECT * FROM `tbl_contacts` ORDER BY `FirstName`";
          $resultdesigner = $conn->query($designersql);

          if ($resultdesigner->num_rows > 0) {
          $resultdesigner->MoveFirst;
          echo("<option value='designer_".$KitchConfigID."'></option>");
          while($rowdesigner = $resultdesigner->fetch_assoc()) {
          $DesignerName = $rowdesigner["FirstName"]." ".$rowdesigner["LastName"];
          $DesignerID = $rowdesigner["ContactID"];
          if($rowdesigner["ContactID"]==$rowkitch["Designer"]){
          echo("<option value='".$DesignerID."' selected='selected'>".$DesignerName."</option>");
          }
          else {
          echo("<option value='".$DesignerID."'>".$DesignerName."</option>");
          }
          }
          }
          echo("</select>
        <input type='text' name='".$SelField."' value='' />
        <label for='designer_".$KitchConfigID."' class=''>Designer:</label>
      </div>
    </div>
  </div>
  
  
  <div class='md-form mb-0 float-right'>
    <button type='submit' class='btn btn-outline-danger waves-effect btn-sm float-right'>Save <i class='fas fa-magic ml-1'></i></button>
  </div>


For the Output i use:
 

    $upd_KitchConfigID = $_GET["kcid"];
    if(isset($_POST["configname$upd_KitchConfigID"]))
        {
           $upd_KitchConfig = $_POST["configname$upd_KitchConfigID"];
        }
        else
        {
            $upd_KitchConfig = 'NotSet';
            $ErrMsg = $ErrMsg . 'No KitchConfig, ';
        }
    
    if(isset($_POST["designer$upd_KitchConfigID"]))
        {
           $upd_KitchConfigDesigner = $_POST["designer_$upd_KitchConfigID"];
        }
        else
        {
            $upd_KitchConfigDesigner = 1;
            $ErrMsg = $ErrMsg . 'No Designer, ';
        }

echo("designer_$upd_KitchConfigID: ".$_POST["designer_$upd_KitchConfigID"]."<br><br>");


The value of ConfigName is well....BUT
for Designer i receive "Undefined index: designer..."

and i do not know why.
I'm shure it's a mistake by my stupid coding...but i can't find the error.

Maybe anybody of you guys can help me out?
thnx in advance!!!

BR,
Max

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.