Jump to content

davocold

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Posts posted by davocold

  1. Yes, your onclick will work. If you want to make a function, you can do the following

    <input type="radio" onclick="my_name_change_func('english');" ....
    ... later in your script...
    function my_name_change_func(nm){
        document.getElementById('pfc_words').name = nm;
    }
    

     

    thanks alot, i used the onclick and it changes the name but only once, if i click another radio button to change it back to the previous name, it doesn't.  would the function way of doing this fix it?

  2. You can just use the following

    document.getElementById('pfc_words').name = 'MY_NEW_NAME';

    you don't need jquery or anything else

     

    thanks, i want the change when a radio button is selected, i mean when i select a radio button i want the name of the pfc_words change to "english". How do i go about doing that?

     

    can i use

    onClick="document.getElementById('pfc_words').name = 'MY_NEW_NAME';"

    in radio button?

  3. Here is the text input box:

    <input type="text" name="english" onkeyup="transcrire()"

    id="pfc_words"

    title="<?php echo _pfc("Enter your message here"); ?>"

    maxlength="<?php echo $max_text_len; ?>"/>

     

    I have the following radio buttons:

    <input type="radio" name="language" value="" checked onClick="french();"/><label for="language">French </label> <input type="radio" name="language" value="" onClick="english();"/> <label for="language">English </label>

     

    i need a function to change the name of the text input "english" depending on the radio button selected. if the first radio button is selected i want the text input name set to "french" and if the second radio button is selected i want text input name set to "english".

  4. how do i replace a specific line in a text file with an array string?

     

    example:

     

    text content is like this:

     

    red,brown,green,black

    black,green,red,brown

    green,black,brown,red

     

    so if i have $array = "purple,grey,pink,cyan";

     

    how can i use fwrite to replace line 2 in text file which is green,black,brown,red with $array

     

    i want to replace the whole line 2 with the arrray string.

  5. this is not working. :(

     

    i think i should try a diffrent aproach.

     

    how do i replace a particular line in a text file with an array string?

     

    example:

     

    text content is like this:

     

    red,brown,green,black

    black,green,red,brown

    green,black,brown,red

     

    so if i have $array = "purple,grey,pink,cyan";

     

    how can i use fwrite to replace line 2 in text file which is green,black,brown,red with $array

     

    i want to replace the whole line 2 with the arrray string.

  6. well thats what serialize does. How are you doing to be using this textfile? if you just want to store the value of the array so you can access the array again (and use it like an array) than sasa's script is the way to go

     

    isn't there any way i can dump everything in the array to  a text file without adding any extra characters or line breaks?

  7. try

    <?php
    //$myarray=array(array(1,2,3),2,array('sasa','red'), 3);
    echo "before writing to file<br />\n";
    echo "<pre>"; 
    echo print_r($myarray);
    echo "</pre>\n";
    $fp = fopen('textfile.txt', 'w');
    fwrite($fp, serialize($myarray));
    fclose($fp);
    echo '<hr />';
    $newarray = unserialize(file_get_contents('textfile.txt'));
    echo "after readin from file<br />\n";
    echo "<pre>", print_r($newarray), "</pre>\n";
    
    ?>

     

     

    it works but it is writing some extra chars with the array contents.

    anyway to clean this up?

  8. foreach goes through the first array (an array of arrays) each element (in that case $row) is also an array, so you go through each of those arrays to get the value. then you write the value to the page.

     

    can i see your code?

     

    $fp = fopen('textfile.txt', 'w');

    fwrite($fp, '$myarray');

    fclose($fp);

     

     

    array contains:

     

    red,brown,green,black

    black,green,red,brown

    green,black,brown,red

     

     

     

     

    i want to write the arry to the text file exactly as it is.

  9. i have the text file text.txt containing the following:

    john,male,36,libra

    jane,female,28,cancer

    stive,male,33,gemini

    and so on

    i am able to read each line and edit its contents

    the edited line is assigned to a variable.

    what i need is a function that will replace a specific line in the text file with the new variable

    i tried using fopen, fwrite, fclose but it is deleting everything in the text file.

    i have a loop that ammends each line and i would like to include a write function in it.

    Thanks,

×
×
  • 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.