marjan_m 11 Junior Poster

Hi,

please check the following code;

<?
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Admin Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="<?=$_SERVER['DOCUMENT_ROOT']?>/admin/stylesheet/adminstyle.css" type="text/css" rel="stylesheet">
<? echo $_SERVER['DOCUMENT_ROOT']."/admin/stylesheet/adminstyle.css"; ?>
<script>
	function chk(name)
	{
	
		if(name == 'pro')
		{
		document.getElementById("content").src = "view_provinces.php";
	
		}
		if(name == 'loc')
		{
		document.getElementById("content").src = "view_locations.php"
		}
	
	}

</script>
</head>

<body id="mainpage">
	
<div id="main">

	<div id="header">
		EyeOnPakistan Admin Panel
	</div>

	<div id="welcome">
	Welcome <? echo $_SESSION['username'].":"; ?> <a id="logout" href="logout.php">Logout</a>
	</div>

	<div id="header1">

	Your last visit was on:
	</div>


	<div id="navigation">
	<ul>
		
  		<li id="pro"><a href="#" onClick="chk('pro')" id="province">Provinces</a></li>
		
	     <li id="loc"><a href="#" onClick="chk('loc')">Locations</a></li>
		
    	 <li id="slide"><a href="#" onClick="chk('slideshow')">Slide Show</a> </li>
		
      	<li id="users"><a href="#" onClick="chk('users')">Users</a></li>
	  <li id="updates"><a href="#" onClick="chk('users')">Updates</a></li>
  	  <li id="search"><a href="#" onClick="chk('users')">Search</a></li>
	</ul>
	</div>

	<div>
	
		<iframe height="700" width="730" id="content" scrolling="no" frameborder="0">
		</iframe>
		
	</div>
	
	<div id="footer">
	Copyright © 2009 EyeOnPak.All rights reserved.	
	</div>

</div>
</body>
</html>

and the css code is:

.header_txt
{
background-color:#485C91;
color:#FFFFFF;
}
.mainTable
{
background-color:#CCFF99;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
border-collapse:collapse;
border-color:#003399;
font-weight:bold;
height:550px;
}

.admin_header
{
font-family:"Trebuchet MS";
font-weight:bold;
text-align:center;
font-size:14px;
color:#CC6600;
background-color:#CCFFCC;
}
td
{
color:#003366;
}

td.login
{
color:#003366;
text-align:center;
}
.loginbtn
{
color:#FFFFFF;
font-family:"Courier New", Courier, monospace;
font-size:12px;
background-color:#CC6600;

}
.indexTable
{
background-color:#CCCCCC;

font-family:"Trebuchet MS";
font-size:14px;
border-collapse:collapse;
font-weight:bold;


}

.link
{
font-size:10px;
font-weight:bold;
color:#990000;
font-family:Verdana, Arial, Helvetica, sans-serif;
text-shadow:#003399;
}

.detail
{
border-color:#009999;
color:#0099CC;
}
.pages
{

font-family:"Trebuchet MS";
font-size:14px;
color:#CCFF99;
}

.loctable
{
font-size:11px;
font-family:"Verdana";
margin-top:25px;
}
.inner_head
{
background-color:#0099CC;
letter-spacing:3px;
font-size:10px;
font-weight:bold;
color:#FFFFFF;
}

.wite
{
color:#FFFFFF;
}

.t_tr
{
/*background-color:#33CCCC;*/
background-color:#ADF8B9;
}

.t_tr2
{
background-color:#D6FCED;
}

.t_heading …
marjan_m 11 Junior Poster

Hi,

I am trying to create tabs using two images, the main background image and then the mouse over image, code i hv written after reading guidelines from a book so thats why cant completly understand where is the problem:

css code:

body {
font: 62.5%/1.5 Verdana, Arial, Helvetica, sans-serif;
background-color:#E5E5E5;
}

#content {
border-top: 1px solid #898989;
border-right: 1px solid #898989;
border-bottom: 1px solid #898989;
border-left: 1px solid #898989;
}

#navContainer {

font: 1.1em Arial, Helvetica, sans-serif;
text-align: center;
padding: 20px 0 0;
}

#navigation
{
padding:0px;
}

#navigation a:link {
text-transform: uppercase;
text-decoration: none;
padding: 5px 10px;
position: relative;
margin-right: 5px;
}

#navigation a:visited {
text-transform: uppercase;
text-decoration: none;
padding: 5px 10px;
position: relative;

}

#navigation #contactDetailsPageLink a:link, #navigation
#contactDetailsPageLink a:visited {
margin-right: 0;
}
<!-- to change font color of links-->
#navigation a:visited {
color:#CCCCCC;


}
#navigation a:hover {
background-image:url(tab-hover.JPG);
color:#FFFFFF;
}


#navigation ul {
list-style: none;
margin-bottom:5px;

}

#navigation li {
display: inline;
padding: 0px 9px;
background-image:url(main_tab.JPG);
}

#navigation a:active {
color:#FFFFFF;
}

#wrapper {
margin-top:0px;
margin-left:95px;
}
</style>

Html code is:

<body id="homepage">

<div id="navContainer">
<div id="navigation">
<ul>
     <li id="pro"><a href="#" onClick="chk('pro')">Provinces</a></li>
		
      <li id="loc"><a href="#" onClick="chk('loc')">Locations</a></li>
		
      <li id="slide"><a href="#" onClick="chk('slideshow')">Slide Show</a> </li>
		
      <li id="users"><a href="#" onClick="chk('users'">Users</a></li>
		</ul>
	</div>
</div>


<div id="wrapper">
	<iframe height="1000" width="800" id="content" scrolling="no" frameborder="0">
	</iframe>
</div>
</body>

I have attached the two images also. First the problem is that there should not be any space between the tabs, and secondly the tab-hover image is not accurate.

Please …

marjan_m 11 Junior Poster

whats your server configuration? We can start there.

Thanks for your reply.

I dont know how to configure the mail server, as i have used the mail() function in the code and its giving warning to configure the mail server. I want to know exactly how it can be resolved?

marjan_m 11 Junior Poster

Hi,

I need to use mail function to send emails to the user provided e-mail address which he/she gave at the time of registration. Can any one please help me regarding this?

Thanks

marjan_m 11 Junior Poster

from DATA base (DB).

for more details: i have MYSQL and PHP instaed in machine only there no connect to any network (localhost).
as you see the program i posted before. from the html i put query then the program output table (data set) on html page. what i am looking how to use query to input from html file.
example: if have to unpdata table Clients i want to creat HTML page and by feeling all field (name, dob, address) and after pressing submit query will input this information on the table client.
thank you

As per I can reach to your problem you want to create such an html page from where you enter values and that values will be inserted in the table "client". For this the html page will be:

<!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=iso-8859-1" />
<title>Add new Client</title>
</head>

<body>
<form method="post" action="insertClient.php">

	<table align="center" width="80%">
	
		<tr>
			<td><input type="text" name="name" /></td>
		</tr>
		
		
		<tr>
			<td><input type="text" name="add" /></td>
		</tr>
		
	</table>
	
</form>
</body>
</html>

and code for createClient.php is as follows:

<?

	// write here db connectivity code
	
/* value posted by user at html page. It will be retrived by post 
 method and should be saved in php variables */

	$name = $_POST["name"]; 
	$add = $_POST["add"];

/* applying insert query. here the "name" and "add" are the name of db fields from client table and "$name", "$add" …
marjan_m 11 Junior Poster

Thanks, m8. I almost got it working. So, first of all if I put the .js code in the function it doesn't load the script - just keeps loading forever.
So, tooking your suggestion, I'm using this code instead:

<script language="javascript" type="text/javascript">
function calendar()
{
document.write("<script language='JavaSc" + "ript' src='http://atat.ro/js/calendar-ortodox.js'></sc" + "ript>")
}
</script>
<input type="submit" onclick="calendar()" value="Calendar Ortodox" name="Calendar" />

... which works, kin of... It loads the script in a new browser window.
Can I make it load under the button, on the same page, I mean? I want the button to show on all pages and the script to load, also, on the site's pages.
BTW, here it is http://atat.ro , upper-right column, just above the social bookmark icons.
Thanks again!

Yes it can be done as:

Make a separate file for your java script code and save it with extension ".js" as it will be "filename.js"

Place that js function in that file.

Remember not to use the script tag in that separate js file.

Place the button in your html pages and just make the same function call.

Remember to include the js file in all the pages where u need to use that button and make the same function call.

A js file can be included as:

<script src="filename.js"></script>

I hope it will be helpful to you. All the best

marjan_m 11 Junior Poster

I have no ideea how to do this.

It can be done as:

<head>
<script language="javascript" type="text/javascript">
function test()
{
// write ur code here

}
</script>
</head>

And the html code will be:

<body>
<input type="submit" onclick="test()" />
</body>

If you have any problem then please post your java script code here

marjan_m 11 Junior Poster

From where you want to insert data in this table? from an html page that any user has submitted or from the DB?

marjan_m 11 Junior Poster

Hi, all!
I have a problem I hope someone smarter then me will fix :)
So, I'm integrating a javascript in my site:

<script language="JavaScript" src="/js/ortodox.js" type="text/javascript"></script>

as you can see, is in a separate .js file. The site loads too slow, because of this.
What I'd like to do is to load the javascript only when the vizitor click a particular link. I don't know if is possible, though.

Also, I found many onclick link codes that show the content of a particular hidden div or table (or whatever). However, what I don't know is: if I put the code above in a hidden div, will it still load and slow the site or it will load when the div is displayed?

Make a function in that js file and put all the code of js in the function. Call that function on onclick event of any link or button.

marjan_m 11 Junior Poster

Does the following line specifies the location? if so then how can we specify a country of asia

map.setCenter(new GLatLng(37.4419, -122.1419), 13);

Thanks for your time

marjan_m 11 Junior Poster

Thanks for your reply. I have read that helping document but can't get the exact idea,so that's why posted question here.

marjan_m 11 Junior Poster

Hi,

Please guide me about embedding google map api in the site page.
I need to show map for different locations which are stored in DB. I got the API key but dont know how to implement it.

Thanks for your time.

marjan_m 11 Junior Poster

Hi,

Can any one please guide me that is there any way in php to add all country names automatically in a list box rather then making a static list of <option>

Thanks for your time.

marjan_m 11 Junior Poster

Thanks for your reply. I am trying to make dynamic the following code:
http://www.ajaxdaddy.com/demo-ajax-carousel.html

please guide

JavaScript image carousel.

marjan_m 11 Junior Poster

Thanks for your reply.

I am trying to use JavaScript image carousel. Please view this link:

http://www.ajaxdaddy.com/demo-ajax-carousel.html

It uses unordered list. Here the lists are static but I am trying to make it dynamic as:

<div id="prev-arrow-container"><img alt="Left3-disabled" id="prev-arrow" src="images/left3-disabled.gif?1163492051" /></div>
<div class="carousel-component" id="html-carousel"><div class="carousel-clip-region">

<ul>
<? 
$count = 0;
while ($count <= $total)
{?>
	
<li>
<img src="images/journeys/gallery/<? echo $arr[$count][0]; ?>" class="thumb" />
</li>
<? 
$count++;
}
?>
</ul>
</div></div>

Here the list's are created dynamically to place some images in those list's as in that code, but it is not working. Please guide.

Perhaps ajax.
I checked the source code and appears that at least javascript to some degree must have been used since there is no hyperlink but instead an oop reference with javascript. Then and although I haven't dug in deep enough to confirm this but it appears there is some server to client communication that updates the div fields. That's about all that I have found so far.

marjan_m 11 Junior Poster

Hi,

Please view the following link:

http://travel.yahoo.com/p-travelguide-191501619-beijing_vacations-i;_ylt=AiZdwxCyxFHHjdvlVEe4GeQyFWoL

Here can any one please guide me that how the pictures are changing in the vertical are at right side?

Thanks

marjan_m 11 Junior Poster

it does not require a full URL but give it a try anyway.

Does the page POST BACK?
This might happen cuz you have not specified '#' in the href property of the anchor tag

Thanks for your time and guidance. The problem was that I was not specifying the href property. Now it is resolved.

Thanks for your help.

marjan_m 11 Junior Poster

marjaan_m

at first glance it looks like your this line is wrong
give the full path and then try
e.g if you are at localhost then

http://localhost/xyz/functions/travellerdetail.php

obj_t.open("GET","functions/travellerdetail.php?tid="+id,true);

Thanks for your time and suggestion.

marjan_m 11 Junior Poster

I have tried your code but it is not giving the output, then I have corrected the script tag in mine code. Still the problem exists.

marjan_m 11 Junior Poster

The inner html of div is changed at state 4 but then vanishes at 1, why the states has sequence of 2,3,4 and then except of having the correct sequence of 1,2,3,4

marjan_m 11 Junior Poster

Thanks for your help. Did you get the output of this code?

marjan_m 11 Junior Poster

Thanks for your time. I am posting the whole code, please guide about the mistakes.

<?
include "functions/mysql.php";
?>

<!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=iso-8859-1" />
<title>Find Travellers</title>
<link rel="stylesheet" type="text/css" href="stylesheet/style.css">
<script>
var obj_t;
function create()
{

	obj_t = new XMLHttpRequest();
	if(obj_t == null)
	{
	
		alert("Your broweser does not support it");
	}
	
}

function data()
{

	if(obj_t!= null)
		{	
						
			if(obj_t.readyState == 4)
			{

				var dv = document.getElementById('tdetail');
				dv.innerHTML = obj_t.responseText;

		
			}
			
		}
}

function createRequest(id)
{
	
	
	obj_t.open("GET", "functions/travellerdetail.php?tid="+id , true);

	obj_t.onreadystatechange = data;
	obj_t.send(null);

}


function showdetail(tid)
{

	create();
	createRequest(tid);
	
}
</script>
</head>

<body>
<table>
<tr><td>
<?$Q = mysql_query("select * from travellers where t_type = 'air'");?>
<div id="byair">
	<? 
	while($R = mysql_fetch_array($Q))
	{ 
	?>
	<br />
	<a href="" class="tlink" onclick="showdetail(<? echo $R["t_id"]; ?>)"  id="<? echo $R["t_id"]; ?>" name="<? echo $R["t_name"]; ?>">
				<? echo $R["t_name"]; ?> </a>

	<? }
	?>
	</div></td></tr>
<tr><td><div id="tdetail"></div></td></tr>
</table>
marjan_m 11 Junior Poster

Thanks for your reply.

Mine code was also working fine. I have checked by alert that it reaches on state 4 and displays data, but the data vanishes after state 4. First it shows state 2 then 3 , then 4 and then 1. Why the div is not holding the data permanently?

marjan_m 11 Junior Poster

Hi,

I am trying to implement the following ajax code:

function create()
{

	obj_t = new XMLHttpRequest();
	if(obj_t == null)
	{
	
		alert("Your broweser does not support it");
	}
	
}

function data()
{

	if(obj_t!=null)
		{

			if(obj_t.readyState == 4)
			{
			
				var dv = document.getElementById('tdetail');
				dv.innerHTML = obj_t.responseText;

			
			}
			
		}
}

function createRequest(id)
{

	obj_t.open("GET","functions/travellerdetail.php?tid="+id,true);
	obj_t.onreadystatechange = data;
	obj_t.send(null);

}


function showdetail(tid)
{

	create();
	createRequest(tid);
	
}

I have called the showdetail function a link click and passed it's id. The problem is that the dv is not updated data. Is there any problem with the link?

Thanks for your time.

marjan_m 11 Junior Poster
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script>
function album()
{

 t = setTimeout("document.getElementById('pic').style.visibility = 'visible' ",5000);
									
}

function album_hide()
{
	clearTimeout(t);
}
</script>
</head>

<body>
<table>
<tbody>
<td>
<?php
$no = 1;
while( $no < 6 ) 
{ 
$pic = "pic".$no;
echo $pic;
?>
<script> album(); </script>
<div id="pic">
<img src="images/journeys/gallery/<?=$R4["$pic"];?>" width="200" height="200" /></div>
<script> album_hide(); </script>									
<?php 
$no+= 1;
$pic= "";
}
?>
</td>
</tbody>
</table>
</body>
</html>

output:

pic1
pic2
pic3
pic4
pic5

Thanks for your reply. I got the same output but the problem is it just display fisrt pic after 5000 if I dont use cleartimeout(). And if I use it, it will not show any pic. I need to make visible the div after 5000 ms and then to hide it untill the next picture come in from the DB.

I hope you can now understand the problem.

marjan_m 11 Junior Poster

Not every thing which looks empty can be supposed really empty!

marjan_m 11 Junior Poster

Thanks for your help. But it is still not working.

marjan_m 11 Junior Poster

Hi,

I am trying to display 5 pics named "pic1", "pic2"....."pic5" in one div.
I have settled that the div will be visible after 5000 ms, and then i have settled cleartimeout function to make the div again hidden. I need to revise it 5 times so that 5 pictures will display in one div one by one.

Please help me by correcting the following code:

<td>
<?
$no = 1;
while( $no < 5 ) 
{ 
$pic = "pic".$no;
echo $pic;
?>
<script> album(); </script>
<div id="pic">
<img src="images/journeys/gallery/<? echo $R4["$pic"]; ?>" width="200" height="200" /></div>
<script> album_hide(); </script>									
<? 
$no+= 1;
$pic= "";
}
?>
</td>

Java script functions are:

function album()
{

 t = setTimeout("document.getElementById('pic').style.visibility = 'visible' ",5000);
									
}

function album_hide()
{
	clearTimeout(t);
}

Thanks for your concern and time.

marjan_m 11 Junior Poster

Thanks for your reply.

Can you please tell me that how can I set to display a pic after some seconds?

marjan_m 11 Junior Poster

Hi,

I need to know about creating dynamic slide show or dynamic photo gallery in php. Can any one please help.

Thanks
Regards,

marjan_m 11 Junior Poster

I had designed the map to some extent using the following tutorial:

http://www.youtube.com/watch?v=satMTNW5tWY

iamthwee commented: n i c e +11
marjan_m 11 Junior Poster

Hi,

Can any one please guide me how to create an interactive map of any country in FLASH? Or if you can suggest any other software for this purpose?

Thanks & Regards,

marjan_m 11 Junior Poster

Hi,

Can any one please guide me about exporting db with designer settings from phpmyadmin.

I need that all the tables and relations ships which I created in phpmyadmin designer should be added when I export the db. Can it be possible?

Thanks
Regards,

marjan_m 11 Junior Poster

Can you please tell me what is the error in the following code, why it is not showing value in the text box.

<form name="game" action="gcheck.php" method="post">
<table align="center" width="71%">
  <tr>
    <td align="center"><h3>&nbsp;</h3> </td>
    <td width="33%" align="center">Computer think a number between 1-20</td>
    <td align="center">&nbsp;</td>
    <td align="center">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td width="26%">Enter your guess here:</td>
    <td><input type="text" name="guess_value" id="guess_value"/></td>
<td><? 
switch ( $_GET["e"] )
{
	case 1:
		echo "You did not enter any number";
		break;
			
		case 2:
			
		echo "The number you entered is out of range";
		break;
		
}
?></td>
<td>&nbsp;</td>
  </tr>
	<tr>
	  <td>&nbsp;</td>
	  <td>&nbsp;</td>
	  <td>&nbsp;</td>
	  <td>&nbsp;</td>
    </tr>
	<tr>
	  <td>Chance 1: </td>
	  <td><label>

 <input type="text" name="ch1" disabled= "true" id="ch1" value= "<? echo $_POST['ch1'];  ?>" />
	<? 
	if( $_GET["e"] == 3 || $_GET["e"] == 4) 
	 {   
	echo "
	<script>
	{
	 document.getElementById('ch1').disabled = false; 
	 document.getElementById('guess_value').readOnly = true;
	 }
 </script>";
}
		
?>  
 </label></td>
  <td>
  <? 
   switch ( $_GET["e"] )
	{
	case 3:
		echo "Guessed no is less...You are given first chance";
			break;
	
	case 4:
			
		echo "Guessed no is greater...You are given first chance";
			break;

		}
  ?>
 
  </td>
  <td>&nbsp;</td>
    </tr>
<tr>
      <td>Chance 2: </td>
  <td><label>
        <input type="text" name="ch2" disabled="true" id="ch2"/>
	<? 
	if( $_GET["e"] == 5 || $_GET["e"] == 6) 
	 {   
	echo "
	<script>
	{
	 document.getElementById('ch2').disabled = false; 
	 document.getElementById('ch1').disabled = false; 
	 document.getElementById('ch1').style.backgroundColor = '#FFFFCC';
	 document.getElementById('ch1').readOnly = true;

 }
 </script>";
	 
}
	
?>  
   </label></td>
  <td>
  <? 
  
   switch ( $_GET["e"] )
	{
	case 5:
		echo "Guessed no is greater...You are given second chance";
		break;
		
	case 6:
		
		echo "Guessed no is less...You are given second chance"; …
marjan_m 11 Junior Poster

Thanks for your help

$value = isset($_POST['name']) ? $_POST['name']:"10"; ? is called Ternary Operator. In the example above, I am checking if $_POST is set and has a value. If has a value, I am assigning it to the variable $value. If it doesn't have any value, I am assigning 10 to $value.
You can read more about ternary operator here.
http://in.php.net/operators.comparison

This will retain whatever value the user had entered in the textbox "ch1".

Edit: I don't recommend using <? (or short tags). Short tags are turned off on most servers, which would result in printing the php code to the screen. Use <?php instead.

marjan_m 11 Junior Poster

Thanks for your help. Can you please explain me this line:

$value = isset($_POST['name']) ? $_POST['name']:"10";

if I place $_POST instead of 10 then will it be correct?

or it can be possible as:

<input type="text" name="ch1" value = "<?echo  $_POST['ch1']; ?>" />

I don't see element guess_value in this code! :) Well, here is an example.

<?php
$value = isset($_POST['name']) ? $_POST['name']:"10";
?>
<html>
<body>
<form method='post'>
<input type='text' name='name' value='<?php echo $value; ?>' readOnly='readOnly'>
<input type='submit' name='submit' value='submit'>
</form>
</body>
</html>

I have hard-coded value 10. You can replace it with whatever value (of the variable) you are printing in guess_value.

marjan_m 11 Junior Poster
<input type="text" name="ch1" disabled= "true" id="ch1"/>
<? 
if( $_GET["e"] == 3 || $_GET["e"] == 4) 
 {   
echo "<script>
     {
     document.getElementById('ch1').disabled = false; 
     document.getElementById('guess_value').readOnly = true;
     }
    </script>";
}

?>  
<input type="text" name="ch2" disabled="true" id="ch2"  />
<? 
if( $_GET["e"] == 5 || $_GET["e"] == 6) 
 {  // [B]Here I need to retain the value of first text box entered by user [/B]
echo "<script>
   {
 document.getElementById('ch2').disabled = false; 
 document.getElementById('ch1').disabled = false; 
document.getElementById('ch1').style.backgroundColor = '#FFFFCC';
 document.getElementById('ch1').readOnly = true;
 }
 </script>";

}
		
?>

Can you post your code ? You have to retain the value of the textbox. :)

marjan_m 11 Junior Poster

Thanks for your reply. The entered value disappears when I click the button, even if I make it readonly. I need to make the text box value read only after first click.

readOnly .

marjan_m 11 Junior Poster

<input type="text" name="" disabled >

Thanks for your reply.

But the disabled attribute does not show the value. I want that the value should not be disappered after user clicks submit button and also the value should be unchangable.

marjan_m 11 Junior Poster

Hi,

I need to set a text feild value unchangable after a user enter first time. I dont want to use it's "readOnly" attribute as it let's the user to select the text.

Thanks
Regards,

marjan_m 11 Junior Poster

What is the error in this code:

<input type="text" name="ch1" disabled= "true" id="ch1"
<? 
if( $_GET["e"] == 3 || $_GET["e"] == 4) 
 {   
echo "<script>{ document.getElementById('ch1').disabled = false; } </script>";
}
?>  />

It show an extra "/>" in output.

marjan_m 11 Junior Poster

Yes I have checked this option also quoted by w3schools, but it is not working. I have searched and some tutorials quoted that "disable" and "readonly" properties can only have one value same like their name:

<input type="text" disabled= "disabled">

<offtopic>
Strangely, http://www.w3schools.com/htmldom/prop_text_disabled.asp says textObject.disabled=true|false
But, when I use <input type= "text" id='ch1' name ="ch1" disabled='false' /> it doesn't work.. It still disables the textbox :S
</offtopic>
Anyways, I hope I am wrong and someone else have a way to enable already disabled textbox without using javascript.. :)

marjan_m 11 Junior Poster

But the problem with java script is that it can be disabled by the user on browsers. There should be a way to implement it by php.

As far as I know, once you have printed a html element, you can't change it (unless you use javascript). Even almostbob's code decides whether to enable or disable the textbox at runtime.

marjan_m 11 Junior Poster

I need to enable it by using php.

If it is disabled by default and on certain condition, you want it to enable it, you have to use javascript.

marjan_m 11 Junior Poster

Thanks for your reply. I need to enable a disabled text box as this text box will be disabled by default, so should i write:

<input type= "text" name ="ch1" <?php if(!S_GET['e'] == 3)  {echo "disabled=\"false\"";} ?>">
<input type= "text" name ="ch1" <?php if(!S_GET['e'] == 3)  {echo "disabled=\"disabled\"";} ?>">
marjan_m 11 Junior Poster

Thanks for your reply. How it can be done, can you please guide?

This simply wouldn't work because this is how your source would look like.

<input type= "text" name ="ch1" disabled='true'
disabled='false'/>
marjan_m 11 Junior Poster

I need to enable a disabled text box through php.Please inform me about the errors in the following code:

<input type= "text" name ="ch1" disabled = "true"
<?
if ( $_GET["e"] == 3 )
echo "disabled = 'false' ";
?>
/>
marjan_m 11 Junior Poster

I didnot searched it's solution yet.

marjan_m 11 Junior Poster

It's ok. Thanks for your time. The problem is resolved. It will be:

<input type="text" name="ch1" <? if( $_GET["e"] == 1) echo 'disabled';?> />
marjan_m 11 Junior Poster

Thanks for your reply. But if I dont want to use java script then how it can be possible?