2 Replies Latest reply on Apr 28, 2016 6:43 AM by beverly

    how to make radio button in php to show data from filemaker server?

    rj.rijo

      Im using php to connect to the filemaker server. But i dont know how to make the radio button show the data from the filemaker server, for example : there is two radio button 'A' and 'B', if A is stored in filemaker server then in php radio button 'A' should be selected automatically and if i select the radio button 'B' then on clicking save button 'B' should be saved in filemaker server.

       

      This is my code:

       

      <!DOCTYPE html>

      <html lang="en">

       

       

      <?php

      include ("dbaccess.php");

      ?>

       

       

      <?php

      //Set message variable for IIS server. Any variables left empty and not defined on IIS will throw a 500 error.

      $message = "";

       

       

      # Check the POST name to see if the user clicked the Save button.

      if (isset($_POST['save']) and $_POST['save'] == 'Save') {

        # Tell FileMaker to edit the record.

        # Before the data is sent back to the database you can validate it here. No examples of validation are shown in the example.

        # Please see the demo for InsertRecordValidation.php

        # This is just a straight forward insert demo.

        $edit = $fm->newEditCommand('Contacts', $_REQUEST['id']);

        # Set the fields with the values from the $_POST superglobal

        $edit->setField('Title', $_POST['Title']);

        $edit->setField('FirstName', $_POST['FirstName']);

        $edit->setField('LastName', $_POST['LastName']);

        $edit->setField('Designation', $_POST['Designation']);

        $edit->setField('BirthDate', $_POST['BirthDate']);

        $edit->setField('Mission', $_POST['Mission']);

        $edit->setField('Church', $_POST['Church']);

        $edit->setField('Address', $_POST['Address']);

        $edit->setField('PostOffice', $_POST['PostOffice']);

        $edit->setField('City', $_POST['City']);

        $edit->setField('PIN', $_POST['PIN']);

        $edit->setField('State', $_POST['State']);

        $edit->setField('District', $_POST['District']);

        $edit->setField('Block', $_POST['Block']);

        $edit->setField('OfficePhone', $_POST['OfficePhone']);

        $edit->setField('HomePhone', $_POST['HomePhone']);

        $edit->setField('Mobile', $_POST['Mobile']);

        $edit->setField('Email', $_POST['Email']);

        $edit->setField('TypeOfMinistry', $_POST['TypeOfMinistry']);

        $edit->setField('MainMinistry', $_POST['MainMinistry']);

        $edit->setField('DataCollectedBy', $_POST['DataCollectedBy']);

        $edit->setField('TeamLeaderName', $_POST['TeamLeaderName']);

        $edit->setField('Notes', $_POST['Notes']);

       

       

        //Date and TimeStamp are disabled in the POST, no need to update the values

        //$edit->setField('Date', $_POST['Date']);

        //$edit->setField('TimeStamp', $_POST['TimeStamp']);

        # Execute the newEditCommand

        //$edit->execute();

       

       

        # Update the message variable to tell the user the record has been saved.

        //$message = '<p>Your changes have been saved</p>';

       

        $result = $edit->execute();

      if ($fm->isError($result))

      {

           print "Error:" . $result->getMessage();

      }

      else

      {

           print "Your changes have been saved.";

      }

       

       

      }

       

       

      # Make sure there is a record that corresponds to the RecordID. If not, stop the script.

      if (empty($_GET['id'])) {

          die('The record no longer exists.');

      }

       

       

      # Find the record using getRecordByID using the id passed in the URL

      $record = $fm->getRecordById('Contacts', $_GET['id']);

       

       

      # Create variables for all the fields for output in the html

      $ContactID = $record->getField('ContactID');

      $Title = $record->getField('Title');

      $FirstName = $record->getField('FirstName');

      $LastName = $record->getField('LastName');

      $FullName = $record->getField('FullName');

      $Designation = $record->getField('Designation');

      $BirthDate = $record->getField('BirthDate');

      $Mission = $record->getField('Mission');

      $Church = $record->getField('Church');

      $Address = $record->getField('Address');

      $PostOffice = $record->getField('PostOffice');

      $City = $record->getField('City');

      $PIN = $record->getField('PIN');

      $State = $record->getField('State');

      $District = $record->getField('District');

      $Block = $record->getField('Block');

      $OfficePhone = $record->getField('OfficePhone');

      $HomePhone = $record->getField('HomePhone');

      $Mobile = $record->getField('Mobile');

      $Email = $record->getField('Email');

      $TypeOfMinistry = $record->getField('TypeOfMinistry');

      $MainMinistry = $record->getField('MainMinistry');

      $YearOfData = $record->getField('YearOfData');

      $DataCollectedBy = $record->getField('DataCollectedBy');

      $TeamLeaderName = $record->getField('TeamLeaderName');

      $Notes = $record->getField('Notes');

       

       

      $DataCollectedBy = $record->getField('DataCollectedBy');

      $DataEnteredBy = $record->getField('DataEnteredBy');

      $DataEntryDate = $record->getField('DataEntryDate');

      $DataLastUpdated = $record->getField('DataLastUpdated');

       

       

      ?>

       

       

          <head>

       

       

              <meta charset="utf-8">

              <meta http-equiv="X-UA-Compatible" content="IE=edge">

              <meta name="viewport" content="width=device-width, initial-scale=1">

              <title>IHF</title>

       

       

              <!-- CSS -->

              <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500">

              <link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">

              <link rel="stylesheet" href="assets/font-awesome/css/font-awesome.min.css">

        <link rel="stylesheet" href="assets/css/form-elements.css">

              <link rel="stylesheet" href="assets/css/style.css">

       

       

              <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->

              <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->

              <!--[if lt IE 9]>

                  <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>

                  <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>

              <![endif]-->

       

       

              <!-- Favicon and touch icons -->

              <link rel="shortcut icon" href="assets/ico/favicon.png">

              <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">

              <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">

              <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">

              <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">

       

        <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">

       

       

       

       

          </head>

       

       

          <body>

       

       

        <!-- Top menu -->

        <nav class="navbar navbar-inverse navbar-no-bg" role="navigation">

        <div class="container">

        <div class="navbar-header">

        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#top-navbar-1">

        <span class="sr-only">Toggle navigation</span>

        <span class="icon-bar"></span>

        <span class="icon-bar"></span>

        <span class="icon-bar"></span>

        </button>

        <a class="navbar-brand" href="index.html">IHF</a>

        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->

        <div class="collapse navbar-collapse" id="top-navbar-1">

        <ul class="nav navbar-nav navbar-right">

        <li>

        <span class="li-text">

       

        </span>

        <a href="#"><strong>| Home |</strong></a>

        <a href="#"><strong>| Indian Harvest Directory |</strong></a>

        <a href="#"><strong>| Christian Gathering Survey |</strong></a>

        <a href="#"><strong>| About |</strong></a>

        <span class="li-text">

       

        </span>

        <span class="li-social">

        <a href="#"><i class=""></i></a>

        <a href="#"><i class=""></i></a>

        <a href="#"><i class=""></i></a>

        <a href="#"><i class=""></i></a>

        </span>

        </li>

        </ul>

        </div>

        </div>

        </nav>

       

       

              <!-- Top content -->

              <div class="top-content">

           

                  <div class="inner-bg">

                      <div class="container">

                          <div class="row">

                              <div class="text">

                                  <h1><strong></strong></h1>

                                  <div class="description">

                                  <p>

                                  </p>

                                  </div>

                              </div>

                          </div>

                          <div class="row">

                              <div class="col-sm-12 form-box">

                           

       

        <form action="edit_entry.php?id=<?php echo $_GET['id']; ?>" method="post" class="registration-form">

       

                           

                              <fieldset>

                                <div class="form-top">

                                <div class="form-top-left">

                                <h3>Contact Details</h3>

                                    <p></p>

                                </div>

                                <div class="form-top-right">

                                <h3><a href="contact_list.php">Contact List</a></h3>

                                </div>

                                   </div>

                                   <div class="form-bottom">

        <table style="width:100%">

        <tr>

        <td width="33%">

        <table>

        <tr>

        <th>ContactID</th>

        <td><?php echo $ContactID; ?></td>

         </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="Title">

        Title :

        </label></td>

        <td width="33%"><select id="Title" name="Title" class="field select medium" style="background-color:#FCF5D8;color:black;" tabindex="11">

         <option value="<?php echo $Title; ?>"><?php echo $Title; ?></option>

       

        </select></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="FirstName">First Name : </label></td>

        <td width="33%"><input size="20%" id="" name="FirstName" type="text" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $FirstName; ?>" ></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="LastName">Last Name : </label></td>

        <td width="33%"><input size="20%" id="" name="LastName" type="text" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $LastName; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="FullName">Full Name : </label></td>

        <td width="33%"><?php echo $FullName; ?></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="Designation" for="Designation">

        Designation :

        </label></td>

        <td width="33%"><select id="" name="Designation" class="field select medium" style="background-color:#FCF5D8;color:black;" tabindex="11">

         <option value="<?php echo $Designation; ?>"><?php echo $Designation; ?></option>

        </select></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="Field106">

        Gender :

        </label></td>

        <td width="33%"><input id="radioDefault_5" name="Field5" type="hidden" value="">

        <input id="Field5_0" name="Field5" type="radio" value="Male" tabindex="5" checked="checked">

        <label class="choice" for="Field5_0">Male</label>&nbsp&nbsp&nbsp

        <input id="Field5_1" name="Field5" type="radio" value="Female" tabindex="6">

        <label class="choice" for="Field5_1">Female</label></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="BirthDate">Date of Birth : </label></td>

        <td width="33%"><input size="20%" id="datepicker" name="BirthDate" type="text" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $BirthDate; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="Mission">Mission : </label></td>

        <td width="33%"><input id="" name="Mission" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $Mission; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="Church">Church : </label></td>

        <td width="33%"><input id="" name="Church" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $Church; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="Address">Address : </label></td>

        <td width="33%"><input id="" name="Address" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $Address; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="PostOffice">PostOffice : </label></td>

        <td width="33%"><input id="" name="PostOffice" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $PostOffice; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="City">City/Town : </label></td>

        <td width="33%"><input id="" name="City" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $City; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="PIN">Pin : </label></td>

        <td width="33%"><input id="" name="PIN" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $PIN; ?>" size="8" tabindex="1"></td>

        </tr>

        </table>

        </td>

        <td width="33%"><table>

        <tr>

        <td width="33%"><label class="desc" id="" for="State">

        State :

        </label></td>

        <td width="33%"><select id="" name="State" class="field select medium" style="background-color:#FCF5D8;color:black;" tabindex="11">

         <option value="<?php echo $State; ?>"><?php echo $State; ?></option>

        </select></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="District">

        District :

        </label></td>

        <td width="33%"><select id="" name="District" class="field select medium" style="background-color:#FCF5D8;color:black;" tabindex="11">

         <option value="<?php echo $District; ?>"><?php echo $District; ?></option>

        </select></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="Block">

        Block :

        </label></td>

        <td width="33%"><select id="" name="Block" class="field select medium" style="background-color:#FCF5D8;color:black;" tabindex="11">

         <option value="<?php echo $Block; ?>"><?php echo $Block; ?></option>

        </select></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="Field106">

        Director :

        </label></td>

        <td width="33%"><input id="" name="Director5" type="hidden" value="">

        <input id="Director5_0" name="Director5" type="radio" value="Director" tabindex="5" checked="checked">

        <label class="choice" for="Director5_0">Yes</label>&nbsp&nbsp&nbsp

        <input id="Director5_1" name="Director5" type="radio" value="No" tabindex="6">

        <label class="choice" for="Director5_1">No</label></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="title106" for="Field106">

        Coordinator :

        </label></td>

        <td width="33%"><input id="Coordinator_5" name="Coordinator5" type="hidden" value="">

        <input id="Coordinator5_0" name="Coordinator5" type="radio" value="Coordinator" tabindex="5" checked="checked">

        <label class="choice" for="Coordinator5_0">Yes</label>&nbsp&nbsp&nbsp

        <input id="Coordinator5_1" name="Coordinator5" type="radio" value="No" tabindex="6">

        <label class="choice" for="Coordinator5_1">No</label></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="Field106">

        Team Leader :

        </label></td>

        <td width="33%"><input id="" name="Team_Leader5" type="hidden" value="">

        <input id="Team_Leader5_0" name="Team_Leader5" type="radio" value="Team_Leader" tabindex="5" checked="checked">

        <label class="choice" for="Team_Leader5_0">Yes</label>&nbsp&nbsp&nbsp

        <input id="Team_Leader5_1" name="Team_Leader5" type="radio" value="No" tabindex="6">

        <label class="choice" for="Team_Leader5_1">No</label></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="Field106">

        Field Worker :

        </label></td>

        <td width="33%"><input id="" name="Field_Worker5" type="hidden" value="">

        <input id="Field_Worker5_0" name="Field_Worker5" type="radio" value="Field_Worker" tabindex="5" checked="checked">

        <label class="choice" for="Field_Worker5_0">Yes</label>&nbsp&nbsp&nbsp

        <input id="Field_Worker5_1" name="Field_Worker5" type="radio" value="No" tabindex="6">

        <label class="choice" for="Field_Worker5_1">No</label></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="title106" for="Field106">

        Office Staff :

        </label></td>

        <td width="33%"><input id="Office_Staff_5" name="Office_Staff5" type="hidden" value="">

        <input id="Office_Staff5_0" name="Office_Staff5" type="radio" value="Office_Staff" tabindex="5" checked="checked">

        <label class="choice" for="Office_Staff5_0">Yes</label>&nbsp&nbsp&nbsp

        <input id="Office_Staff5_1" name="Office_Staff5" type="radio" value="No" tabindex="6">

        <label class="choice" for="Office_Staff5_1">No</label></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="title106" for="Field106">

        Volunteer :

        </label></td>

        <td width="33%"><input id="Volunteer_5" name="Volunteer5" type="hidden" value="">

        <input id="Volunteer5_0" name="Volunteer5" type="radio" value="Volunteer" tabindex="5" checked="checked">

        <label class="choice" for="Volunteer5_0">Yes</label>&nbsp&nbsp&nbsp

        <input id="Volunteer5_1" name="Volunteer5" type="radio" value="No" tabindex="6">

        <label class="choice" for="Volunteer5_1">No</label></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="OfficePhone" for="OfficePhone">Office Phone : </label></td>

        <td width="33%"><input id="OfficePhone" name="OfficePhone" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $OfficePhone; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="HomePhone">Home Phone : </label></td>

        <td width="33%"><input id="" name="HomePhone" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $HomePhone; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="Mobile">Mobile : </label></td>

        <td width="33%"><input id="" name="Mobile" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $Mobile; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="Email">Email : </label></td>

        <td width="33%"><input id="" name="Email" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $Email; ?>" size="8" tabindex="1"></td>

        </tr>

        </table>

        </td>

        <td width="33%"><table>

        <tr>

        <td width="33%"><label class="desc" id="title106" for="Field106">

        Paid :

        </label></td>

        <td width="33%"><input id="Volunteer_5" name="Volunteer5" type="hidden" value="">

        <input id="Volunteer5_0" name="Volunteer5" type="radio" value="Volunteer" tabindex="5" checked="checked">

        <label class="choice" for="Volunteer5_0">Yes</label>&nbsp&nbsp&nbsp

        <label class="choice" for="Volunteer5_1">No</label></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="TypeOfMinistry">

        Type of Ministry :

        </label></td>

        <td width="33%"><select id="" name="TypeOfMinistry" class="field select medium" style="background-color:#FCF5D8;color:black;" tabindex="11">

         <option value="<?php echo $TypeOfMinistry; ?>"><?php echo $TypeOfMinistry; ?></option>

        </select></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="MainMinistry">Main Ministry : </label></td>

        <td width="33%"><input id="" name="MainMinistry" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $MainMinistry; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="title106" for="Field106">

        Present Status :

        </label></td>

        <td width="33%"><input id="presentstatus_5" name="presentstatus5" type="hidden" value="">

        <input id="presentstatus5_0" name="presentstatus5" type="radio" value="Active" tabindex="5" checked="checked">

        <label class="choice" for="presentstatus5_0">Active</label>&nbsp&nbsp&nbsp

        <label class="choice" for="presentstatus5_1">Inactive</label></td>

        <label class="choice" for="presentstatus5_2">Others</label></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="YearOfData">Year of Data : </label></td>

        <td width="33%"><?php echo $YearOfData; ?></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="title106" for="Field106">

        Christian Directory Permission :

        </label></td>

        <td width="33%"><input id="christiandirectorypermission_5" name="christiandirectorypermission5" type="hidden" value="">

        <input id="christiandirectorypermission5_0" name="christiandirectorypermission5" type="radio" value="Yes" tabindex="5" checked="checked">

        <label class="choice" for="christiandirectorypermission5_0">Yes</label>&nbsp&nbsp&nbsp

        <label class="choice" for="christiandirectorypermission5_1">No</label></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="DataCollectedBy">Data Collected By : </label></td>

        <td width="33%"><input id="" name="DataCollectedBy" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $DataCollectedBy; ?>" size="8" tabindex="1"></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="TeamLeaderName">Teamleader Name : </label></td>

        <td width="33%"><input id="" name="TeamLeaderName" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $TeamLeaderName; ?>" size="8" tabindex="1"></td>

        </tr>

        <td width="33%"><label class="desc" id="" for="Notes">Notes : </label></td>

        <td width="33%"><input id="" name="Notes" type="text" size="20%" class="field text fn" style="background-color:#FCF5D8;color:black;" value="<?php echo $Notes; ?>" size="8" tabindex="1"></td>

        </tr>

        </table>

        </td>

        </tr>

        </table>

        <button type="button" class="btn btn-next">Next</button>

                           </div>

                           </fieldset>

                         

                           <fieldset>

                                <div class="form-top">

                                <div class="form-top-left">

                                <h3>Gathering Details</h3>

                                    <p></p>

                                </div>

                                <div class="form-top-right">

                                <h3><a href="contact_list.php">Contact List</a></h3>

                                </div>

                                   </div>

                                   <div class="form-bottom">

                             

                               <button type="button" class="btn btn-previous">Previous</button>

                               <button type="button" class="btn btn-next">Next</button>

                           </div>

                           </fieldset>

                         

                           <fieldset>

                                <div class="form-top">

                                <div class="form-top-left">

                                <h3>Official Details</h3>

                                    <p></p>

                                </div>

                                <div class="form-top-right">

                                <h3><a href="contact_list.php">Contact List</a></h3>

                                </div>

                                   </div>

                                   <div class="form-bottom">                

                               <table style="width:100%">

        <tr>

        <td width="33%">

        <table>

        <tr>

        <th>ContactID</th>

        <td><?php echo $ContactID; ?></td>

         </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="DataCollectedBy">Data Collected By : </label></td>

        <td><?php echo $DataCollectedBy; ?></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="DataEnteredBy">Data Entered By : </label></td>

        <td><?php echo $DataEnteredBy; ?></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="DataEntryDate">Data Entry Date : </label></td>

        <td><?php echo $DataEntryDate; ?></td>

        </tr>

        <tr>

        <td width="33%"><label class="desc" id="" for="DataLastUpdated">Data Last Updated : </label></td>

        <td width="33%"><?php echo $DataLastUpdated; ?></td>

        </tr>

        </table>

        </td>

        </tr>

        </table>

                             

                               <button type="button" class="btn btn-previous">Previous</button>

                               <!--<button type="submit" class="btn">Save</button>-->

        <input name="save" type="submit" class="btn" value="Save" />

                           </div>

                           </fieldset>

                         

                           </form>

                         

                              </div>

                          </div>

                      </div>

                  </div>

                

              </div>

       

       

       

       

              <!-- Javascript -->

        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>

              <script src="assets/js/jquery-1.11.1.min.js"></script>

        <script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>

              <script src="assets/bootstrap/js/bootstrap.min.js"></script>

              <script src="assets/js/jquery.backstretch.min.js"></script>

              <script src="assets/js/retina-1.1.0.min.js"></script>

              <script src="assets/js/scripts.js"></script>

       

         <script>

         $(document).ready(function() {

        $("#datepicker").datepicker();

         });

         </script>

            

              <!--[if lt IE 10]>

                  <script src="assets/js/placeholder.js"></script>

              <![endif]-->

       

       

          </body>

       

       

      </html>

        • 1. Re: how to make radio button in php to show data from filemaker server?
          mikebeargie

          Not going to really review your code at all, but think about HOW filemaker stores radio fields. They're just essentially text fields with a "mask" that allows you to select a value. So when you GET the value of that record from filemaker, you'll get it as a text string. You will need to build the mask in PHP yourself to get it to work.

           

          So with that in mind, lets use use your ministry type as an example:

           

          $TypeOfMinistry = $record->getField('TypeOfMinistry');

           

           

          So what you need to do, to build your "mask" on your web side, is to check for if $TypeOfMinistry matches a radio value, and change it accordingly:

          echo "<input type=\"radio\" name=\"TypeOfMinistry"\";

          if (isset($TypeOfMinistry) && $TypeOfMinistry=="TYPE A"){ echo "checked"; }

          echo "value=\"TYPE A\">TYPE A

          <input type=\"radio\" name=\"TypeOfMinistry"\";

          if (isset($TypeOfMinistry) && $TypeOfMinistry=="TYPE B"){ echo "checked"; }

          echo "value=\"TYPE B\">TYPE B";

          Essentially, this line:

          if (isset($TypeOfMinistry) && $TypeOfMinistry=="TYPE A"){ echo "checked"; }

          Checks for IF the TypeOfMinistry exists, and does it match the radio button being setup in order to check it.

           

          When you look at the raw HTML for that radio set, with TYPE A checked, it probably makes more sense:

          <input type="radio" name="TypeOfMinistry" checked value="TYPE A">TYPE A

          <input type="radio" name="TypeOfMinistry" value="TYPE B">TYPE B

           

          Once you've set up your radio button, since the "name" of each radio input is the same, it will write the checked "value" back to your filemaker record with the line you already have:

          $edit->setField('TypeOfMinistry', $_POST['TypeOfMinistry']);

           

          So that's how to setup checkboxes in PHP with filemaker (or any dynamic loaded) data.

          • 2. Re: how to make radio button in php to show data from filemaker server?
            beverly

            Mike is spot on! Remember that Radio buttons on forms are in "groups" with the same Name, but different ID's and different Values and only ONE should be selected out of the set. 'checked' is the modern way of saying this value is the one I have already. It used to be checked="checked", mostly for use with XHTML.

             

            I would write the code this way:

             

             

             

            This is how the radio buttons appear (normally in a blank form) with the addition of a php test to see if the value is already set. If you use any kind of JavaScript, the id is important and may be used to "fill the form" as well as with the values in the database through PHP.

             

            I do something similarly with checkboxes.

             

            beverly