hi
sorry but what you want...
if you want that somebody clicks on button that time textbox enable so you can call javascrit function on button click event
As i posted one example here
<input type="text" disabled="disabled" name="txt1"/>
<input type="button" value="Click me" onblur="func_unlock();">
<script type="text/javascript">
function func_unlock()
{
document.getElementByid('txt1').disabled=false;
}
</script>
Thanks
Tulsa
Junior Poster in Training
77 posts since May 2009
Reputation Points: 13
Solved Threads: 15
hi
sorry atil ....
i post onblur() event here it's my mistake
thanks for that
Tulsa
Junior Poster in Training
77 posts since May 2009
Reputation Points: 13
Solved Threads: 15
>Thanks Tulsa & Atil,
but as far I understand the example you gave is for a specific / one textbox.. Am I right?
What I intend to do is..
What are you doing? Tulsa & Atil explained how to enabled or disabled an item? Is there any problem to write a code for another textbox?
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
ok..thanks.this is my code
<?php
$query= mysql_query(" SELECT * FROM lesson
WHERE lessonID='" . $_GET['lessonID'] . "'");
while($entry=mysql_fetch_array($query))
{
echo " Subject: ";
echo '<input name="subject" readonly="readonly" value="', $entry['subject'] , '" />';
echo " Year:";
echo '<input name="year" readonly="readonly" value="', $entry['year'] , '" />';
}
?>
Your code misses :
1. Form tag
2. Single quote never evaluates/expand variables.
3. No submit buttons.
Get a hint from the given code:
page1.php
<?php
$flag="disabled=\"disabled\"";
$cmd=$_REQUEST["cmd"];
$query= mysql_query(" SELECT * FROM lesson
WHERE lessonID='" . $_GET['lessonID'] . "'");
$no="";
$name="";
if($entry=mysql_fetch_array($query)) {
$no=$entry[0]; $name=$entry[1];
}
if(isset($cmd)) {
if($cmd=="Edit")
$flag="";
else
if($cmd=="Update") {
..... Write code to update a record.
}
}
?>
<form method="post" action="page1.php">
No <input type="text"
<?php echo $flag ?>
name="no"
value="<?php echo $no?>"
/>
<br/>
Name <input type="text"
<?php echo $flag ?>
name="name"
value="<?php echo $name?>"
/>
<input type="submit" name="cmd" value="Edit"/>
<input type="submit" name="cmd" value="Cancel"/>
<input type="submit" name="cmd" <?php echo $flag ?> value="Update"/>
</form>
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
Thanks Atli & Adatapost for your responses.
Adatapost,
What I intend to do is to insert a new record after customising the display data ( by click edit button).. so, I need to change "update" to "insert"..am I?
& how can the id be increased based on the highest id in the table?
thanks
Add another submit button with value="Insert" and name="cmd". Compare value of $cmd and if it is "Insert" then write code to insert a record.
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241