davocold
-
Posts
15 -
Joined
-
Last visited
Never
Posts posted by davocold
-
-
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?
-
thanks, i think am getting somewhere but what am i doing wrong with the following functions
<?php
function english()
{
$('#pfc_words').attr('name', 'english');
}
function saisie()
{
$('#pfc_words').attr('name', 'saisie');
}
?>
-
You want JS/Jquery, what have you tried so far?
Is there a javascript or Jquery code that can change the name "saisie" of the text input to "anothername"?
-
i need a function that can change the name of an input text.
<input type="text" name="saisie" onkeyup="transcrire()" id="pfc_words" title="<?php echo _pfc("Enter your message here"); ?>"maxlength="<?php echo $max_text_len; ?>"/>
-
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".
-
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.
-
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.
-
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?
-
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?
-
did you completely ignore what i wrote? you didn't change anything at all... you just copied your first post and pasted it into a new one
how do i declare the $row and $column
am not sure about the testfile aswell
-
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.
-
if its 1-d
foreach($array as $val){ fwrite($testfile, $val); }
if 2-d
foreach($array as $row){ foreach($row as $column){ fwrite(testfile, $column); } }
you get the idea
i think i need the 2d solution but i can not seem to get it right, could u explain it a bit?
chears
-
array contains the following lines:
red,brown,green,black
black,green,red,brown
green,black,brown,red
How can i write the whole content of the array to a text file?
fwrite($textfile, $array); won't do it
-
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,
function to change input text name
in Javascript Help
Posted
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?