Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7789417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T21:17:34+00:00 2026-06-01T21:17:34+00:00

i am new to JS and Programming.. i want to learn How to Implement

  • 0

i am new to JS and Programming..

i want to learn How to Implement onchange() in a text field in a form and capturing the value of that form field if the value is changed and i want to store that information in a text file, which i can create in php..i already have the text file in which i can use fopen and insert the value. but how to capture and store in some temp variable before writing it to text file.

i am including the code here..

This is from a update page which i am using to update this data…

thanx in advance..

//function for multiple select field 
<script>
function Technology(value,state)
{
   if (value > -1) {
      var input= new Array(value);
      var p;

      var techs = [

         <?php
            $con = mysql_connect("localhost", "root");
            if (!$con)
            {
               die('Could not connect: ' . mysql_error());
            }
            mysql_select_db("root", $con);

            $load = mysql_query("SELECT tech from t_tech");
            while($arr = mysql_fetch_array($load))
            {
               echo "'".$arr[0]."',";
            }
         ?>
      ].sort();
      var ele = document.getElementById("tech");

      if(ele.hasChildNodes())
      {
         var len = ele.childNodes.length;
         while(ele.childNodes.length - value > 1)
         {
            ele.removeChild(ele.lastChild);
         }
      }
      var tech_array = new Array;
      <?php
         for($i = 0;$i<$_POST['tech_num'];$i++)
         {
            $p = $i+1;
            echo "tech_array[$i] = '".$_POST['tech'.$p]."';";
         }
      ?>

      for (var i=len-1;i<value;i++)
      {
         p= i+1;
         input[i] = document.createElement('div');

         if(state ==1 )
         {
            input[i].innerHTML = 'Technology' + p + ':  &nbsp;&nbsp; <input type="text" name="tech' + p + '" id="tech' + p +'" size = 25 value="'+tech_array[i] +'"/>';
         }
         else if (state == 0)
         {
            input[i].innerHTML = 'Technology' + p + ':  &nbsp;&nbsp; <input type="text" value="" name="tech' + p + '" id="tech' + p +'" size = 25/>';
         } 

         document.getElementById("tech").appendChild(input[i]);

         var techId = 'tech' + p;

         AutoComplete_Create(techId,techs);

      }           
}}
</script>  

This is the form field:

<tr> 
   <td><b>
      Field1: <select name="tech_num" id="tech_num" onChange="return Technology(this.value,0)"> 
      <?php 
         for ($i=0;$i<=5;$i++) { 
            if ($i==0) 
               $temp = "<option value=$i> - </option>"; 
            else if($i == $_POST['tech_num']) 
               $temp = "<option value=$i selected='selected'>$i</option>"; 
            else $temp = "<option value=$i>$i</option>"; 
               echo $temp; } 
      ?> 
      </select>
   </td>
</tr> 
</table> 
<div id="tech"> </div> <table>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T21:17:35+00:00Added an answer on June 1, 2026 at 9:17 pm

    To store a value in a text file on the server, you will need to send the data from the client. Your best bet is probably to add an ajax call in the onChange function to a special php page which simply stores the value.

    http://www.w3schools.com/jsref/event_onchange.asp

    http://www.w3schools.com/ajax/default.asp

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to programming and want to find something that I can work on
I want to learn a new programming language and develop for the Android platform.
Hello I am very new to programming. I want to learn very fastly joomla
I want to learn a new programming language. I have in mind stuff like
I want to learn a new programming language in 2011. I am a java
do we need to learn a new programming language if we want to use
I am new to programming. I have lots of interest in networking and want
I'm new to Flex, although not new to programming. I want to write a
i'm new at C Programming (i learned c++) i want to create a process
I'm relatively new to .NET programming (and OOP in general) and I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.