Wednesday 19 December 2012

Storing image in database using php/ mysql

First in this tutorial, creating web form and posting data on next page ,as image and  data stored on table. I have mention  3 details below.
1. Creating Web form
2. Storing  Image on database using Page 2
3. Table created where value is stored.
===================================================================


Page 1-----
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<form action="18decres.php" method="post" enctype="multipart/form-data" target="_blank">
<table>
<tr><td>
<h1 align="center"><u><b>LETTER HEAD</b></u></h1><br />
<hr>
<h6 align="right">Photo<input type="hidden" name="MAX_FILE_SIZE" value="10000000" />
                <input name="image" type="file" />
                                            </h6><p align="right"><em><small><text  align="right">
  To be attested by head of office</small></em></p><BR>
<h5><b>Subject: </b>Verification of employement for <input type="text" name="a" size="10"/> [employee name] to NIC Certifying Authority.</h5>

<p>This letter is to confirm that <input type="text" name="b" size="10"/>[<i>Applicant Name</i>] is working in <input type="text" name="c" size="10"/>[<i>Organisation name</i>] as <input type="text" name="d" size="10"/>[<i>Designation</i>]. He/She has been working in this organisation since<input type="text" name="e" size="10"/> [<i>Date of joining</i>].His/Her tenure is till <input type="text" name="f" size="10"/>[<i>dact</i>]
<br />
<br />
<br />
<b><u>Additional declaration forxxxxxxxxxxxs:</u></b><br />
<input type="text" name="g" size="10"/>[<i>DSC Applicant Name</i>] is working in<input type="text" name="h" size="10"/> [<i>Organisation xxxx</i>]. His/Her contract is valid from <input type="text" name="i" size="10"/>to <input type="text" name="j" size="10"/>.
<table>
<tr><td align="right">Yours Sincerely,<br />
[<i>xxxxxxxxe (xxxxxxxx)</i>]<br />
<input type="text" name="k" size="10"/> [<i>xxxxxzzzzzzzxxxxxmp</i>]
</td>
</tr></table>
<em><small>
<input type="submit" name="submit" value="Save Changes"  />
</small></em></td></tr></table>
</form>
</body>
</html>
===================================================================

Page 2..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
 <?php
     $a = $_POST['a'];
$b = $_POST['b'];
$c = $_POST['c'];
$d = $_POST['d'];
$e = $_POST['e'];
$f = $_POST['f'];
$g = $_POST['g'];
$h = $_POST['h'];
$i = $_POST['i'];
$j = $_POST['j'];
$k = $_POST['k'];    
        ?>
 <form action="" method="post">
<table>
<tr><td>
<h1 align="center"><u><b>LETTER HEAD</b></u></h1><br />
<hr>
<h6 align="right">Photo<?php error_reporting (E_ALL ^ E_NOTICE); ?>
 

</h6><p align="right"><em><small><text  align="right">
  To be attested by head of office</small></em></p><BR>
<h5><b>Subject: </b>Verification of employement for <b><?php echo $a;?> to NIC Certifying Authority.</h5>

<p>This letter is to confirm that <b><?php echo $b;?></b> is working in <b> <?php echo $c;?></b> as <b><?php echo $d;?></b>.He/She has been working in this organisation since <b><?php echo $e;?></b>. His/Her tenure is till <b><?php echo $f;?></b>
<br />
<br />
<br />
<b><u>Additional declaration for contactual employees:</u></b><br />
<b><?php echo $g;?></b> is working in <b><?php echo $h;?></b>. His/Her contract is valid from <b><?php echo $i;?></b> to <b><?php echo $j;?></b>.
<table>
<tr><td align="right">Yours Sincerely,<br />
[<i>Head of Office/Office-In-Charge (for contract employee)</i>]<br />
<b><?php echo $k;?></b>
</td>
</td></tr>
</td></tr></table>
</form>
<?php
                                                                if (isset($_POST['submit']) && $_FILES['image']['size'] > 0) {
                                                                    $fileName = $_FILES['image']['name'];
                                                                    $tmpName = $_FILES['image']['tmp_name'];
                                                                    $fileSize = $_FILES['image']['size'];
                                                                    $fileType = $_FILES['image']['type'];

                                                                    $fp = fopen($tmpName, 'r');
                                                                    $content = fread($fp, filesize($tmpName));
                                                                    $content = addslashes($content);
                                                                    fclose($fp);

                                                                    if (!get_magic_quotes_gpc()) {
                                                                        $fileName = addslashes($fileName);
                                                                    }
                                                                    $objConnect = mysql_connect("localhost", "root", "") or die(mysql_error());
                                                                    $objDB = mysql_select_db("database name");

//$query = "INSERT INTO upload (name, size, type, content ) ".
//"VALUES ('$fileName', '$fileSize', '$fileType', '$content')";
//mysql_query($query) or die('Error, query failed');
                                                                 
                                                                    //echo "<br>File $fileName uploaded<br>";
                                                                    //$certi = serialize($_POST['cbcretificate']);
                                                                    //  $objConnect = mysql_connect("localhost","root","123456") or die(mysql_error());
//$objDB = mysql_select_db("phpmyadmin");
//$cbcretificate = $_POST['cbcretificate'];
                                                                    //$cbcretificate=$_POST["cbcretificate"];
//while (list ($key,$val) = @each ($cbcretificate))
                                                                    //{echo "$val,";
                                                                    //}
//$selected_colors = "";
//foreach ($cbcretificate as $cbcretificate) {
//$selected_cert .= $cbcretificate . ", ";
//}
//$selected_cert = substr($selected_cert, 0, -2);
//implode(',', $_POST['cbcretificate']);
//$cbcretificate=serialize($_POST['cbcretificate']); //takes the data from a post operation...
//$media_array = $_POST['cbcretificate'];
//foreach ($media_array as $one_media) {
//$source .= $one_media.", ";
//}
//$media = substr($source, 0, -2);$q1 = "select * from firstpagetable4 where ApplicantID IN (select max(ApplicantID) from firstpagetable4)  ";
                                                                    $q2 = "select * from sc_scr_print_new1 where ApplicantID IN (select max(ApplicantID) from sc_scr_print_new1)  ";

                                                                    $res1 = mysql_query($q2);
                                                                    $output_str2 = ' ';
                                                                    while ($row = mysql_fetch_assoc($res1)) {

                                                                        $output_str2 .= ($row['ApplicantID'] + 1); //the site link is for example
                                                                        // $output_str .= '<a href="pdf.php' . $row["max(ApplicantID)+1"] . '">  Click here to generate PDF</a>' . $tab;
//echo" <h1>'<a  href="pdf.php?postid=' . $row["max(ApplicantID)+1"] . '">Click here to generate PDF</a>'.$tab;
                                                                    }



                                                                    $strSQL = "INSERT INTO letter ";



                   $strSQL .="(ApplicantID,name,size,type,content,a,b,c,d,e,f,g,h,i,j,k) ";
        $strSQL .="VALUES ";
$strSQL .="('','" . $fileName . "','" . $fileSize . "','" .      $fileType . "','" . $content . "','" . $_POST["a"] . "','" . $_POST["b"] . "' ";
$strSQL .=",'" . $_POST["c"] . "','" . $_POST["d"] . "','" . $_POST["e"] . "' ";
$strSQL .=",'" . $_POST["f"] . "'";
$strSQL .=",'" . $_POST["g"] . "','" . $_POST["h"] . "','" . $_POST["i"] . "','" . $_POST["j"] . "','" . $_POST["k"] . "')";
$objQuery = mysql_query($strSQL);

 printf(" Your Applicant ID is  %d\n", mysql_insert_id());


//$lastid=mysql_insert_id();
                                                                    if ($objQuery) {
                                                                        echo ".";
                                                                    } else {
                                                                        echo "Error Save [" . $strSQL . "]";
                                                                    }
                                                                    $inserted_id = mysql_insert_id();
//$strsql1="Select Image  from Applicantform22";
//$result_last_id=mysql_query($strsql1);

                                                                    mysql_close($objConnect);
                                                                }
                                                                ?>

</body>
</html>


=============================================================

Table 


CREATE TABLE IF NOT EXISTS `letter` (
  `ApplicantID` mediumint(9) NOT NULL AUTO_INCREMENT,
  `name` varchar(30) NOT NULL,
  `size` int(11) DEFAULT NULL,
  `type` varchar(20) DEFAULT NULL,
  `content` mediumblob,
  `a` varchar(30) NOT NULL,
  `b` varchar(30) NOT NULL,
  `c` varchar(30) NOT NULL,
  `d` varchar(30) NOT NULL,
  `e` varchar(30) NOT NULL,
  `f` varchar(30) NOT NULL,
  `g` varchar(30) NOT NULL,
  `h` varchar(30) NOT NULL,
  `i` varchar(30) NOT NULL,
  `j` varchar(30) NOT NULL,
  `k` varchar(30) NOT NULL,
  PRIMARY KEY (`ApplicantID`)
) ;

Thursday 6 September 2012

Triple Drop Down List Using Javascript


<!-- The first select list -->
                                                                                    <select class="textfield" name="slist1" onchange="SList.getSelect('slist2', this.value);">
                                                                                        <option  value="000" selected="selected">Select Option</option>
                                                                                        <option value="Government">Government User</option>
                                                                                        <option value="PSU & Statutory Bodies">PSU & Statutory Bodies</option>
                                                                                        <option value="NIC">National Informatics Center</option>
                                                                                        <option value="Registered Companies">Registered Companies</option>
                                                                                    </select>
                                                                                    <!-- Tags for the other 2 dropdown list, and for text-content -->

<!-- The second select list -->

<span id="slist2" ></span>
 <!-- The Third  select list -->                                                                                                                                                                       <span id="slist3"  ></span>

                                                                                                                                                                        <div align="center" id="scontent" ></div>


<script><!--
            /* Script Triple Select Dropdown List, from: www.coursesweb.net/javascript/ */
            var SList = new Object();             // JS object that stores data for options

            // HERE replace the values with the text you want to be displayed near Select
            var txtsl2 = 'Selected Media :';         // text for the seccond dropdown list
            var txtsl3 = 'Payment Option :';         // text for the third dropdown list

            /*
         Property with options for the Seccond select list
         The key in this object must be the same with the values of the options added in the first select
         The values in the array associated to each key represent options of the seccond select
             */
            SList.slist2 = {







                "Government": ['.Smart Card','.Smart Card & Reader', '.USB Token', '.SSL/Renewal'],
                "PSU & Statutory Bodies": ['Smart.. Card', 'Smart.. Card & Reader', 'USB..Token', 'SSL/..Renewal'],
                "NIC": ['.Smart. Card', '.Smart. Card & Reader', '.USB. Token', '.SSL./Renewal'],
                "Registered Companies": ['.Smart.. Card', '.Smart.. Card & Reader', '.USB.. Token', '.SSL/..Renewal'],
            };

            /*

         Property with options for the Third select list
         The key in this object must be the same with the values (options) added in each Array in "slist2" above
         The values in the array associated to each key represent options of the third select
             */
            SList.slist3 = {
                ".Smart Card": ['.Demand Draft', '.Payment Directly'],
                ".Smart Card & Reader": ['..Demand Draft', '..Payment Directly'],
                ".USB Token": ['...Demand Draft','...Payment Directly'],
                ".SSL/Renewal": [ '.No Payment to be made'],
                "Smart.. Card": ['Deamnd.. Draft','Payment..Directly'],
                "Smart.. Card & Reader": ['.Demand.. Draft','.Payment..Directly'],
                "USB.. Token": ['Demand..Draft','Payment..Directly'],
                "SSL/..Renewal": ['Demand...Draft','Payment...Directly'],
                ".Smart. Card": ['.No Payment to be made for NIC'],
                ".Smart. Card & Reader": [ '..No Payment to be made for NIC'],
                ".USB. Token": ['No. Payment to be made for NIC'],
                ".SSL./Renewal": ['No.. Payment to be made for NIC'],
                ".Smart.. Card": ['..Demand..Draft','..Payment.. Directly'],
                ".Smart.. Card & Reader": ['.Demand..Draft','.Payment.. Directly'],
                ".USB.. Token": ['.Demand.Draft.','.Payment.Directly.'],
                ".SSL/..Renewal": ['.Demand.Draft..','.Payment.Directly..'],
            };

            /*
         Property with content associated to the options of the third select list
         The key in this object must be the same with the values (options) added in each Array in "slist3" above
         The values of each key represent the content displayed after the user selects an option in 3rd dropdown list
             */
            SList.scontent = {
                ".Demand Draft": '<table border="0" bordercolor="#3366FF" cellpadding="0" cellspacing="0"><tr> <td colspan="2"><font color="red">DD in favour of  "Accounts Officer, NIC Delhi" payable at New Delhi*</font> </td></tr><tr> <td>Draft Amount<strong><font color="red">*</font> </td><td><input type="text" class="textfield" name="draft_amount" id="draft_amount"  readonly="readonly" value="716" size="35"/><i>(Not editable)</i></td>\n\
        <tr><td>Draft No.<font color="red">*</font></td><td><input type="text" class="textfield" name="draft_no" id="draft_no"  size="35"/></td></tr>\n\
         <tr><td>Draft Bank &amp; Branch<font color="red">*</font></td><td><input type="text"  class="textfield" name="bank_branch" id="bank_branch"  size="35"/></td></tr>\n\<br/>\n\
        \n\
        <tr><td>Draft Date (DD/MM/YYYY)<font color="red">*</font></td><td><select name="dd_date">\n\  <option value="000" selected="selected">Date</option>\n\
<?php
for ($i = 1; $i <= 31; $i++) {
    echo "<option>$i</option>";
}
?>\n\
                                                                </select>&nbsp;<select name="dd_month">\n\
                                                                    <option value="000">month</option>\n\
<?php
for ($i = 1; $i <= 12; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>&nbsp;<select name="dd_year">\n\
                                                                    <option value="000">Year</option>\n\
<?php
for ($i = 2012; $i <= 2050; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>\n\
                                                                </td></tr>\n\</table>\n\ ',

        ".Payment Directly": ' PAYMENT DIRECTLY',






        "..Demand Draft": '<table border="0" bordercolor="#3366FF" cellpadding="0" cellspacing="0" ><tr> <td colspan="2"><font color="red">DD in favour of  "Accounts Officer, NIC Delhi" payable at New Delhi*</font> </td></tr><tr> <td>Draft Amount<strong><font color="red">*</font> </td><td><input type="text" class="textfield" name="draft_amount" id="drft_amnt"  readonly="readonly" value="716" size="35"/><i>(Not editable)</i></td>\n\
        <tr><td>Draft No.<font color="red">*</font></td><td><input type="text" class="textfield" name="draft_no" id="draft_no"  size="35"/></td></tr>\n\
         <tr><td>Draft Bank &amp; Branch<font color="red">*</font></td><td><input class="textfield" type="text" name="bank_branch" id="bank_branch"  size="35"/></td></tr>\n\<br/>\n\
        \n\
        <tr><td>Draft Date (DD/MM/YYYY)<font color="red">*</font></td><td><select name="dd_date">\n\  <option value="000" selected="selected">Date</option>\n\
<?php
for ($i = 1; $i <= 31; $i++) {
    echo "<option>$i</option>";
}
?>\n\
                                                                </select>&nbsp;<select name="dd_month">\n\
                                                                    <option value="000">month</option>\n\
<?php
for ($i = 1; $i <= 12; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>&nbsp;<select name="dd_year">\n\
                                                                    <option value="000">Year</option>\n\
<?php
for ($i = 2012; $i <= 2050; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>\n\
                                                                </td></tr>\n\</table>\n\ ',

        "..Payment Directly": 'SMART CARD READER PAYMENT DIRECTLY',
        "GUSB_Checque /Draft": '<table border="0" bordercolor="#3366FF" cellpadding="0" cellspacing="0"><tr> <td colspan="2"><font color="red">DD in favour of  "Accounts Officer, NIC Delhi" payable at New Delhi*</font> </td></tr><tr> <td>Draft Amount<strong><font color="red">*</font> </td><td><input type="text" class="textfield" name="draft_amount" id="draft_amount"  readonly="readonly" value="555" size="35"/><i>(Not editable)</i></td>\n\
        <tr><td>Draft No.<font color="red">*</font></td><td><input type="text" class="textfield" name="draft_no" id="draft_no"  size="35"/></td></tr>\n\
         <tr><td>Draft Bank &amp; Branch<font color="red">*</font></td><td><input type="text" class="textfield" name="bank_branch" id="place3"  size="35"/></td></tr>\n\<br/>\n\
        \n\
        <tr><td>Draft Date (DD/MM/YYYY)<font color="red">*</font></td><td><select name="dd_date">\n\  <option value="000" selected="selected">Date</option>\n\
<?php
for ($i = 1; $i <= 31; $i++) {
    echo "<option>$i</option>";
}
?>\n\
                                                                </select>&nbsp;<select  class="textfield" name="dd_month">\n\
                                                                    <option value="000">month</option>\n\
<?php
for ($i = 1; $i <= 12; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>&nbsp;<select name="dd_year">\n\
                                                                    <option value="000">Year</option>\n\
<?php
for ($i = 2012; $i <= 2050; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>\n\
                                                                </td></tr>\n\</table>\n\ ',

        "...Demand Draft": 'GOVT USB NO PAYMENT',
        "GUSB_Payment Directly": 'GOVT USB PAYMENT DIRECTLY',

        "GSSL_No Payment to be made": 'For RENEWAL/SSL NO PAYMENT to be made',



        "PSC_Checque /Draft": '<table border="0"  bordercolor="#3366FF" cellpadding="0" cellspacing="0"><tr> <td colspan="2"><font color="red">DD in favour of  "Accounts Officer, NIC Delhi" payable at New Delhi*</font> </td></tr><tr> <td>Draft Amount<strong><font color="red">*</font> </td><td><input type="text" name="draft_amount" class="textfield" id="draft_amount"  readonly="readonly" value="916" size="35"/><i>(Not editable)</i></td>\n\
        <tr><td>Draft No.<font color="red">*</font></td><td><input class="textfield" type="text" name="draft_no" id="draft_no"  size="35"/></td></tr>\n\
         <tr><td>Draft Bank &amp; Branch<font color="red">*</font></td><td><input type="text" class="textfield" name="bank_branch" id="bank_branch"  size="35"/></td></tr>\n\<br/>\n\
        \n\
        <tr><td>Draft Date (DD/MM/YYYY)<font color="red">*</font></td><td><select name="dd_date">\n\  <option value="000" selected="selected">Date</option>\n\
<?php
for ($i = 1; $i <= 31; $i++) {
    echo "<option>$i</option>";
}
?>\n\
                                                                </select>&nbsp;<select name="dd_month">\n\
                                                                    <option value="000">month</option>\n\
<?php
for ($i = 1; $i <= 12; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>&nbsp;<select name="dd_year">\n\
                                                                    <option value="000">Year</option>\n\
<?php
for ($i = 2012; $i <= 2050; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>\n\
                                                                </td></tr>\n\</table>\n\ ',

        "PSC_Payment Directly": 'For PSU and Statutory Body PAYMENT DIRECTLY',
        "PSCR_Checque /Draft": '<table border="0"  bordercolor="#3366FF" cellpadding="0" cellspacing="0"><tr> <td colspan="2"><font color="red">DD in favour of  "Accounts Officer, NIC Delhi" payable at New Delhi*</font> </td></tr><tr> <td>Draft Amount<strong><font color="red">*</font> </td><td><input type="text" class="textfield" name="draft_amount" id="drft_amnt"  readonly="readonly" value="916" size="35"/><i>(Not editable)</i></td>\n\
        <tr><td>Draft No.<font color="red">*</font></td><td><input type="text" class="textfield" name="draft_no" id="draft_no"  size="35"/></td></tr>\n\
         <tr><td>Draft Bank &amp; Branch<font color="red">*</font></td><td><input class="textfield" type="text" name="bank_branch" id="place3"  size="35"/></td></tr>\n\<br/>\n\
        \n\
        <tr><td>Draft Date (DD/MM/YYYY)<font color="red">*</font></td><td><select name="dd_date">\n\  <option value="000" selected="selected">Date</option>\n\
<?php
for ($i = 1; $i <= 31; $i++) {
    echo "<option>$i</option>";
}
?>\n\
                                                                </select>&nbsp;<select name="dd_month">\n\
                                                                    <option value="000">month</option>\n\
<?php
for ($i = 1; $i <= 12; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>&nbsp;<select name="dd_year">\n\
                                                                    <option value="000">Year</option>\n\
<?php
for ($i = 2012; $i <= 2050; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>\n\
                                                                </td></tr>\n\</table>\n\ ',

        "PSCR_Payment Directly": 'For PSU and Statutory Body PAYMENT DIRECTLY',
        "PUSB_Checque /Draft": '<table border="0"  bordercolor="#3366FF" cellpadding="0" cellspacing="0"><tr> <td colspan="2"><font color="red">DD in favour of  "Accounts Officer, NIC Delhi" payable at New Delhi*</font> </td></tr><tr> <td>Draft Amount<strong><font color="red">*</font> </td><td><input type="text" class="textfield"  name="draft_amount" id="draft_amount"  readonly="readonly" value="755" size="35"/><i>(Not editable)</i></td>\n\
        <tr><td>Draft No.<font color="red">*</font></td><td><input type="text" class="textfield" name="draft_no" id="draft_no"  size="35"/></td></tr>\n\
         <tr><td>Draft Bank &amp; Branch<font color="red">*</font></td><td><input type="text" class="textfield" name="bank_branch" id="bank_branch"  size="35"/></td></tr>\n\<br/>\n\
        \n\
        <tr><td>Draft Date (DD/MM/YYYY)<font color="red">*</font></td><td><select name="dd_date">\n\  <option value="000" selected="selected">Date</option>\n\
<?php
for ($i = 1; $i <= 31; $i++) {
    echo "<option>$i</option>";
}
?>\n\
                                                                </select>&nbsp;<select name="dd_month">\n\
                                                                    <option value="000">month</option>\n\
<?php
for ($i = 1; $i <= 12; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>&nbsp;<select name="dd_year">\n\
                                                                    <option value="000">Year</option>\n\
<?php
for ($i = 2012; $i <= 2050; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>\n\
                                                                </td></tr>\n\</table>\n\ ',


        "PUSB_Payment Directly": 'For PSU and Statutory Body PAYMENT DIRECTLY',
        "PSSL_Checque /Draft": '<table border="0" bordercolor="#3366FF" cellpadding="0" cellspacing="0"><tr> <td colspan="2"><font color="red">DD in favour of  "Accounts Officer, NIC Delhi" payable at New Delhi*</font> </td></tr><tr> <td>Draft Amount<strong><font color="red">*</font> </td><td><input type="text" class="textfield" name="draft_amount" id="draft_amount"  readonly="readonly" value="200" size="35"/><i>(Not editable)</i></td>\n\
        <tr><td>Draft No.<font color="red">*</font></td><td><input type="text" class="textfield" name="draft_no" id="draft_no"  size="35"/></td></tr>\n\
         <tr><td>Draft Bank &amp; Branch<font color="red">*</font></td><td><input type="text" class="textfield" name="bank_branch" id="bank_branch"  size="35"/></td></tr>\n\<br/>\n\
        \n\
        <tr><td>Draft Date (DD/MM/YYYY)<font color="red">*</font></td><td><select name="dd_date">\n\  <option value="000" selected="selected">Date</option>\n\
<?php
for ($i = 1; $i <= 31; $i++) {
    echo "<option>$i</option>";
}
?>\n\
                                                                </select>&nbsp;<select name="dd_month">\n\
                                                                    <option value="000">month</option>\n\
<?php
for ($i = 1; $i <= 12; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>&nbsp;<select name="dd_year">\n\
                                                                    <option value="000">Year</option>\n\
<?php
for ($i = 2012; $i <= 2050; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>\n\
                                                                </td></tr>\n\</table>\n\ ',

        "PSSL_Payment Directly": 'For PSU and Statutory Body PAYMENT DIRECTLY',


        ".No Payment to be made for NIC": 'No Payment to be made for NIC',


        "..No Payment to be made for NIC": 'No Payment to be made for NIC',

        "No. Payment to be made for NIC": 'No Payment to be made for NIC',

        "No.. Payment to be made for NICC": 'No Payment to be made for NIC',


        "..Demand..Draft": '<table border="0" bordercolor="#3366FF" cellpadding="0" cellspacing="0"><tr> <td colspan="2"><font color="red">DD in favour of  "Accounts Officer, NIC Delhi" payable at New Delhi*</font> </td></tr><tr> <td>Draft Amount<strong><font color="red">*</font> </td><td><input type="text" class="textfield" name="draft_amount" id="draft_amount"  readonly="readonly" value="916" size="35"/><i>(Not editable)</i></td>\n\
        <tr><td>Draft No.<font color="red">*</font></td><td><input type="text"class="textfield"  name="draft_no" id="draft_no"  size="35"/></td></tr>\n\
         <tr><td>Draft Bank &amp; Branch<font color="red">*</font></td><td><input class="textfield" type="text" name="bank_branch" id="bank_branch"  size="35"/></td></tr>\n\<br/>\n\
        \n\
        <tr><td>Draft Date (DD/MM/YYYY)<font color="red">*</font></td><td><select class="textfield"name="dd_date">\n\  <option value="000" selected="selected">Date</option>\n\
<?php
for ($i = 1; $i <= 31; $i++) {
    echo "<option>$i</option>";
}
?>\n\
                                                                </select>&nbsp;<select name="dd_month">\n\
                                                                    <option value="000">month</option>\n\
<?php
for ($i = 1; $i <= 12; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>&nbsp;<select name="dd_year">\n\
                                                                    <option value="000">Year</option>\n\
<?php
for ($i = 2012; $i <= 2050; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>\n\
                                                                </td></tr>\n\</table>\n\ ',
       // "..Payment.. Directly": 'Content for s2o1_1_opt2',
        "..Payment.. Directly": 'PAYMENT DIRECTLY',
        ".Demand..Draft": '<table border="0" bordercolor="#3366FF" cellpadding="0" cellspacing="0"><tr> <td colspan="2"><font color="red">DD in favour of  "Accounts Officer, NIC Delhi" payable at New Delhi*</font> </td></tr><tr> <td>Draft Amount<strong><font color="red">*</font> </td><td><input type="text" name="draft_amount" class="textfield" id="draft_amount"  readonly="readonly" value="916" size="35"/><i>(Not editable)</i></td>\n\
        <tr><td>Draft No.<font color="red">*</font></td><td><input type="text" class="textfield" name="draft_no" id="draft_no"  size="35"/></td></tr>\n\
         <tr><td>Draft Bank &amp; Branch<font color="red">*</font></td><td><input type="text" class="textfield" name="bank_branch" id="bank_branch"  size="35"/></td></tr>\n\<br/>\n\
        \n\
        <tr><td>Draft Date (DD/MM/YYYY)<font color="red">*</font></td><td><select name="dd_date">\n\  <option value="000" selected="selected">Date</option>\n\
<?php
for ($i = 1; $i <= 31; $i++) {
    echo "<option>$i</option>";
}
?>\n\
                                                                </select>&nbsp;<select name="dd_month">\n\
                                                                    <option value="000">month</option>\n\
<?php
for ($i = 1; $i <= 12; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>&nbsp;<select name="dd_year">\n\
                                                                    <option value="000">Year</option>\n\
<?php
for ($i = 2012; $i <= 2050; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>\n\
                                                                </td></tr>\n\</table>\n\ ',

        ".Payment.. Directly": 'For Registered Companies Body PAYMENT DIRECTLY',
        ".Demand.Draft.": '<table border="0" bordercolor="#3366FF"  cellpadding="0" cellspacing="0"><tr> <td colspan="2"><font color="red">DD in favour of  "Accounts Officer, NIC Delhi" payable at New Delhi*</font> </td></tr><tr> <td>Draft Amount<strong><font color="red">*</font> </td><td><input class="textfield"  type="text" name="draft_amount" id="draft_amount"  readonly="readonly" value="755" size="35"/><i>(Not editable)</i></td>\n\
        <tr><td>Draft No.<font color="red">*</font></td><td><input type="text" class="textfield" name="draft_no" id="draft_no"  size="35"/></td></tr>\n\
         <tr><td>Draft Bank &amp; Branch<font color="red">*</font></td><td><input type="text" class="textfield" name="bank_branch" id="bank_branch"  size="35"/></td></tr>\n\<br/>\n\
        \n\
        <tr><td>Draft Date (DD/MM/YYYY)<font color="red">*</font></td><td><select name="dd_date">\n\  <option value="000" selected="selected">Date</option>\n\
<?php
for ($i = 1; $i <= 31; $i++) {
    echo "<option>$i</option>";
}
?>\n\
                                                                </select>&nbsp;<select name="dd_month">\n\
                                                                    <option value="000">month</option>\n\
<?php
for ($i = 1; $i <= 12; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>&nbsp;<select name="dd_year">\n\
                                                                    <option value="000">Year</option>\n\
<?php
for ($i = 2012; $i <= 2050; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>\n\
                                                                </td></tr>\n\</table>\n\ ',

        ".Payment.Directly.": 'For Registered Companies Body PAYMENT DIRECTLY',
        ".Demand.Draft..t": '<table border="0" bordercolor="#3366FF" cellpadding="0" cellspacing="0"><tr> <td colspan="2"><font color="red">DD in favour of  "Accounts Officer, NIC Delhi" payable at New Delhi*</font> </td></tr><tr> <td>Draft Amount<strong><font color="red">*</font> </td><td><input type="text" class="textfield" name="draft_amount" id="draft_amount"  readonly="readonly" value="200" size="35"/><i>(Not editable)</i></td>\n\
        <tr><td>Draft No.<font color="red">*</font></td><td><input type="text" class="textfield" name="draft_no" id="draft_no"  size="35"/></td></tr>\n\
         <tr><td>Draft Bank &amp; Branch<font color="red">*</font></td><td><input type="text"  class="textfield" name="bank_branch" id="bank_branch"  size="35"/></td></tr>\n\<br/>\n\
        \n\
        <tr><td>Draft Date (DD/MM/YYYY)<font color="red">*</font></td><td><select name="dd_date">\n\  <option value="000" selected="selected">Date</option>\n\
<?php
for ($i = 1; $i <= 31; $i++) {
    echo "<option>$i</option>";
}
?>\n\
                                                                </select>&nbsp;<select name="dd_month">\n\
                                                                    <option value="000">month</option>\n\
<?php
for ($i = 1; $i <= 12; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>&nbsp;<select name="dd_year">\n\
                                                                    <option value="000">Year</option>\n\
<?php
for ($i = 2012; $i <= 2050; $i++)
    echo "<option>$i</option>";
?>\n\
                                                                </select>\n\
                                                                </td></tr>\n\</table>\n\ ',

        ".Payment.Directly..": 'For Registered Companies Body PAYMENT DIRECTLY',

    };

    /* From here no need to modify */

   SList.getSelect = function(slist, option) {
  document.getElementById('scontent').innerHTML = '';           // empty option-content

  if(SList[slist][option]) {
    // if option from the last Select, add text-content, else, set dropdown list
    if(slist == 'scontent') document.getElementById('scontent').innerHTML = SList[slist][option];
    else {
      var addata = '<option>Select Option</option>';
      for(var i=0; i<SList[slist][option].length; i++) {
        addata += '<option value="'+SList[slist][option][i]+'">'+SList[slist][option][i]+'</option>';
      }

      // cases for each dropdown list
      switch(slist) {
        case 'slist2':
          document.getElementById('slist2').innerHTML = txtsl2+' <select name="slist2" onchange="SList.getSelect(\'slist3\', this.value);">'+addata+'</select>';
          document.getElementById('slist3').innerHTML = '';
          break;
        case 'slist3':
          document.getElementById('slist3').innerHTML = txtsl3+' <select name="slist3" onchange="SList.getSelect(\'scontent\', this.value);">'+addata+'</select>';
          break;
      }
    }
  }
  else {
    // empty the tags for select lists
    if(slist == 'slist2') {
      document.getElementById('slist2').innerHTML = '';
      document.getElementById('slist3').innerHTML = '';
    }
    else if(slist == 'slist3') {
      document.getElementById('slist3').innerHTML = '';
    }
  }
}
        --></script>


Display Hidden Value using Radio Button


Blue Text - Radio button
Green Text - Javascript 

-----------------------------------------------------------------------------------------------------------

<table width="600" height="65" border="0" bordercolor="#3366FF" cellpadding=
                                                                                                                   "1" cellspacing="1">
                                                                                                                <tr>            <td >width="115"><input type="radio" name="certificate_required" value="Individual Certificate" onclick="doClick2(this)">
                                                                                                                            Individual Certificate</td>
                                                                                                                  <td width="133"><input type="radio" name="certificate_required" value="Time Stamping" onclick="doClick2(this)">
                                                                                                                  Time Stamping</td>
                                                                                                                  <td width="147"><input type="radio" name="certificate_required" value="Code Signing" onclick="doClick2(this)">
                                                                                                                    Code Signing</td>
                                                                                                                    <td width="192">
                                                                                                                        <input type="radio" name="certificate_required" value="SSL Server" onclick="doClick2(this)">
                                                                                                                            SSL Server


                                                                                                                    </td>
                                                                                                                </tr>
                                                                                                                <tr>

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


                                                                                                        <td colspan="2">

                                                                                                        </td>

                                                                                                    </tr>
                                                                                                    <tr>
                                                                                                        <td>&nbsp;</td>
                                                                                                        <td><table width="413" height="31" border="0" cellpadding="1" cellspacing="1">
                                                                                                                <tr>
                                                                                                                    <td bordercolorlight="#6699FF"> 
                                                                                                                        <div id="otherOpt2" style="display:none">


                                                                                                                            <input type="radio" name="Encryption_Certificate" value="Individual Signing">Individual Signing 
                                                                                                                                <br/>
                                                                                                                                <input type="radio" name="Encryption_Certificate" value="Singning Encryption"> Singning Encryption </div></td>
                                                                                                                                    <td bordercolorlight="#6699FF"><div id="textbox2" style="display:none"> <br/>
                                                                                                                                            Web Server<font color="red">*</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                                                                                                            <input type="text" class="header1" name="abc1">
                                                                                                                                                <br/>
                                                                                                                                                <br/>
                                                                                                                                                Service<font color="red">*</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input class="header1" type="text" name="abc2">
                                                                                                                                                    <br/>
                                                                                                                                                    <br/>
                                                                                                                                                    IP Address<font color="red">*</font> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                                                                                                                                    <input type="text" class="header1" name="abc3">
                                                                                                                                                        <br/>
                                                                                                                                                        <br/>
                                                                                                                                                        Domain Name<font color="red">*</font> &nbsp;&nbsp;&nbsp;
                                                                                                                                                        <input type="text" class="header1" name="abc4">
                                                                                                                                                            <br/>
                                                                                                                                                            <br/>
                                                                                                                                                            Physical Location<font color="red">*</font> 
                                                                                                                                                            <input class="header1" type="text" name="abc5">
                                                                                                                                                                </div>    </td>
                                                                                                                                                                </tr>
                                                                                                                                                                </table>




        <script type="text/javascript">
            function doClick2(objRad){
                if (objRad.value=="Individual Certificate"){
                    document.getElementById("textbox2").style.display='none'; //hide textbox

                    document.getElementById("otherOpt2").style.display='block'; //show other options
                }
                else if (objRad.value=="SSL Server"){
                    document.getElementById("otherOpt2").style.display='none'; //hide other options
                    document.getElementById("textbox2").style.display='block'; //show textbox
                }
else if (objRad.value=="Time Stamping"){
                    document.getElementById("otherOpt2").style.display='none'; //hide other options
                    document.getElementById("textbox2").style.display='none'; //show textbox
                }
else if (objRad.value=="Code Signing"){
                    document.getElementById("otherOpt2").style.display='none'; //hide other options
                    document.getElementById("textbox2").style.display='none'; //show textbox
                }

            }
        </script>