divyakrishnan 20 Junior Poster

PHP will runs on Netbean's glassfish server.No need of installing LAMP .Have you installed the netbeans with php ?If not download and install netbeans with php.The project creation is similar to creating java projects.
For More reference visit following link

http://netbeans.org/kb/trails/php.html

divyakrishnan 20 Junior Poster

Hope the following code will works fine for u..

<body>
<?php

    if (isset($_POST['Submit'])) 
	{
    
if ($num_rows == 0) {
	echo '<div class="messText">Sorry, your postcode could not be found - Please try again!</div>';
}
}
else
{?>

<td align="center" valign="center"><br/>
	<?php echo '<div class="messText1">Please click on the Continue button below to view your Times.</div>';
	} ?>
</td>

</body>
divyakrishnan 20 Junior Poster

You are trying to displaying 2 divs on same location.Second one is hiding first div .Use any other css class for second div.Try the following.

<!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>Untitled Document</title>
<style>
.messText {
	position: absolute;
	width: 600px;
	top: 250px;
	margin: 0 auto;
	font-family: 'Comic Sans MS', Arial, sans-serif;
	font-size: 14px;
	font-weight: bold;
	color: red;
	text-align: center;
}

.messText1 {
	position: absolute;
	width: 600px;
	top: 450px;
	margin: 0 auto;
	font-family: 'Comic Sans MS', Arial, sans-serif;
	font-size: 14px;
	font-weight: bold;
	color: red;
	text-align: center;
}
</style>
</head>

<body>
<?php 
if ($num_rows == 0) {
	echo '<div class="messText">Sorry, your postcode could not be found - Please try again!</div>';
}?>

<td align="center" valign="center"><br/>
	<?php echo '<div class="messText1">Please click on the Continue button below to view your Times.</div>'; ?>
</td>

</body>
</html>
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster

Do u want to check the register no in member table before inserting it into student table?

divyakrishnan 20 Junior Poster

Hi..

I want to show a progress bar when downloading a file.
In my script I am clicking a hyperlink and waiting for a while to appear the download box.
I want to display a progress bar before appearing the download box.


I had seen many examples for displaying the progress bar.
But I don't know how to set it for a file downloading.
Has any one had any idea help me.

The code I used(Progress bar appearing every time) is shown below.

<body>
<?php
$ebook="E-BOOK/"."186.exe";
?>

<a title="Click to View Ebook"  href="<?php echo $ebook; ?>" ><b>Ebook</b></a>
<div id="content"><img src="4.gif" alt="Loading, please wait..." border="0"></div>

</body>
divyakrishnan 20 Junior Poster

Hi..
I want to run an exe file without saving from the server by clicking a hyper link.
My code works fine with internet explorer .But with fire fox it showing save button .
I used the following code

<!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>

<!---------Disabling save button works with IE ------------->
<meta name="DownloadOptions" content="nosave" />
<title>Untitled Document</title>


</head>
<body>
<?php
$ebook="E-BOOK/"."186.exe";
?>

<a title="Click to View Ebook"  href="<?php echo $ebook; ?>" ><b>Ebook</b></a>
</body>
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster

Hopes this may help you

<!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=utf-8" />
<title>Untitled Document</title>
<script>
function name_dis()
{
var str=document.f.t1.value;
var lett=str.charAt(0);
document.f.t2.value=lett;
 
}
</script>
</head>

<body>
<form id="form1" name="f" method="post" action="">
  <label>
  <input type="text" name="t1" id="t1" onkeyup="name_dis()"/>
  </label>
  <p>
    <label>
    <input type="text" name="t2" id="t2" />
    </label>
  </p>
</form>
</body>
</html>
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster

Try this code

<body>
<?php
if(isset($_POST['s']))
{
  
 $a=array();
 for($i=0;$i<3;$i++)
 {
 $c='c'.$i;
 if(isset($_POST[$c]))
 {
 echo "R";
 $a[$i]=1;
 }
 else
 {
  $a[$i]=0;

 
 }
 
 }
  
  print_r($a);
  
}
 
 
 
$ck="c";
$i=1;
$name=$ck;
?>
<form id="form1" name="form1" method="post" action="chk_bx.php">
  <input name="<?php echo $name.'0'; ?>" type="checkbox" id="c" value="checkbox" /> 
  ASP
  <input name="<?php echo $name.'1'; ?>" type="checkbox" id="c" value="checkbox" /> 
  JSP
  <input name="<?php echo $name.'2'; ?>" type="checkbox" id="c" value="checkbox" /> 
  PHP
  <input name="s" type="submit" />
</form>
</body>
divyakrishnan 20 Junior Poster

I am using windows.Tried

$filename ='\\\\\\\\192.168.0.15\\E:\\PDF\\p.pdf';

still not working.

divyakrishnan 20 Junior Poster

Hi...
I want to find out whether a file is existing or not
The file is stored on another machine in the same network .
I tried the following code.But always showing "The file is not existing".

<?php $filename = 'file://192.168.0.15/E:/PDF/p.pdf';

if (file_exists($filename))
 {
   echo "The file $filename exists";
} else
 {
   echo "The file $filename does not exist";
}
?>

Does anyone know how to do this?

divyakrishnan 20 Junior Poster

What is your issue?
Want to send multiple parameters via hyperlink?
For that Change your hyper link as

<a href="editComment.php?var1=<?php echo $cmId?>?var2=<?php echo $poId ?>" id="link<?php echo $cmId.$poId?>">Edit</a>
divyakrishnan 20 Junior Poster

Check Out the condition instead of || you have put |

empty($BusDesc) == TRUE | empty($WelcomeMsg) == TRUE
divyakrishnan 20 Junior Poster

Try this Query

SELECT date( date_time_field )
FROM DATA WHERE DATE( date_time_field) = DATE( NOW( ) )
divyakrishnan 20 Junior Poster

Try this script..

<head>
<script>
function windowCenter(pageURL, title,w,h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
</script>
</head>
<body>
<a href="#" onclick="windowCenter('pop_up_window_center.html', 'POPUP',400,400);">OPEN POPUP</a>
</body>
divyakrishnan 20 Junior Poster

Did u checked whether it going inside the if conditions?

divyakrishnan 20 Junior Poster

What you want?Want to print your output with color ?Or want to use a colorful editor fro coding?

divyakrishnan 20 Junior Poster

Use session variables or temporary files to store data.

divyakrishnan 20 Junior Poster

Did u set file permissions for the project folder?
If your server is a Linux server definitely you have to set the file permission.

divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster

Thanks, But the check box is a control of data grid view. It does not have the property checkbox1.Checked.How can I check the check box dynamically?

divyakrishnan 20 Junior Poster

Hi..
How to check a check box based on a condition at run time?

divyakrishnan 20 Junior Poster

Code for generating drop down list as follows

<?php 
$sql="select eid,ename from emp";
$result = mysql_query($sql);
echo "<select name="s">";
while($row = mysql_fetch_array($result))
  {
  ?>
  <option value="<?php echo $row['eid']; ?>" > <?php echo $row['ename'];?> </option>
  
  <?php
  }

?>
divyakrishnan 20 Junior Poster

try this

<?php
echo '<div> <a href=' .$path.$i.$s.$ext. '>  <img src=' .$path.$i.$ext. '> </div>';
?>
divyakrishnan 20 Junior Poster

Hi.
I have a page to send SMS.For that I am linking a third party page using header function.But I could not return to my home page after redirecting that page.I could not have the privilege to edit that third party page.How will I return to my home page after redirecting?Any body have any idea , help me.

divyakrishnan 20 Junior Poster

Where r u using session variables?in PHP right?

divyakrishnan 20 Junior Poster

Change your code as,

<select name="speriod">
<option value='<?php echo $cval; ?> print '>'<?php echo $cval ; ?> print '</option>
</select>
divyakrishnan 20 Junior Poster

Which data type r u using for hindi data?

divyakrishnan 20 Junior Poster

Post your errors.
Then it is easy to find out solution.

divyakrishnan 20 Junior Poster

You can send it using localhost.
I have an example code.
But it is too large.

can you send your mail id as a private message ?

divyakrishnan 20 Junior Poster

Try the following code.
I used ex.txt to store your data file.

<?php
$file1 = fopen("ex.txt", "r") or exit("Unable to openfile!");
//Output a line of the file until the end is reached
$t="";
while(!feof($file1))
  {
$k= fgets($file1);
$pattern = "++ gateway1";

if ( (preg_match("/gateway1/", $k)) || (preg_match("/menu = Gateway1/", $k)) || (preg_match("/title=gateway/", $k)) || (preg_match("/192.168.0.227/", $k))   )
 {

 }
else
{
 $t=$t.$k;
}

  }
 
fclose($file1);

$file = fopen("ex.txt", "w") or exit("Unable to open file!");

fwrite($file,$t);
fclose($file);

?>
divyakrishnan 20 Junior Poster

Align your code properly.It is very difficult to read.

divyakrishnan 20 Junior Poster

Change your code as,

<?PHP
session_start();
//use mysql query 
$username="xxxx";
if ($username)
{ 
setcookie('mycookie',$username, time()+3600);
}
include 'dbconnect.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=utf-8" />
<title>Welcome to site</title>
<link href="container.css" rel="stylesheet" type="text/css" />
<link href="format.css" rel="stylesheet" type="text/css" />
<script src="myjs.js" type="text/javascript"></script>
<body>
<?PHP
include 'header.html';

?>
<div class="maincontainer"><h1>Welcome to the site<a href="nextpage.php"> Click here to continue </a></h1></div>
<?PHP
?>
</body>
</html>

setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Cookies must be sent before any output from your script .This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace.

divyakrishnan 20 Junior Poster

Read line by line from the file using fgets() function.
Store the text u needed on a variable.(Use if statement for that );
After finishing the read operation close the file and again open it in write mode(w).
Write the contents that we are already stored on the variable to the file.

divyakrishnan 20 Junior Poster

Sorry karthik I missed brackets for mysql_error() function.Thank you for your correction

divyakrishnan 20 Junior Poster

Print your insert query after line no 19.

echo $sql;

Copy and paste it into phpmyadmin(or the query analyser u r using).
Execute the query and check out the errors.
Also modify

mysql_query($sql) or die ('Something went wrong with submitting your information <br>'.mysql_error);
karthik_ppts commented: useful post +5
divyakrishnan 20 Junior Poster

Please mark your thread as solved.

divyakrishnan 20 Junior Poster

Try following code

<html>
<body>
<?php
$connect=mysql_connect("localhost","root","ila");
$query="create database if it not exists demo";
$db=mysql_select_db("demo",$connect);
$query= "create table jlt(id int not null , name varchar(49))";
$result=mysql_query($query);
$in=$_POST['inputfield'];
$query="insert into jlt values(1,'$in')";
if(mysql_query($query,$connect)){
echo "data successfully added";
}
else {
echo "not success";
}
?>
</body>
</html>
divyakrishnan 20 Junior Poster

use Ajax concepts.
It will help to refresh a part of a page without refreahing whole page

divyakrishnan 20 Junior Poster

Try this code

<script type="text/javascript">
			if (document.getElementById('other').checked = true) { 
			document.getElementById('whatever').style.visibility = "visible"; 
			} else { 
			document.getElementById('whatever').style.visibility = "hidden"; 
			} 
			
</script> 
<input name="pVital[]" type="checkbox" id="pVital[]" value="I &amp; O" checked="<?php if (in_array('I &amp; O', $pvitals)) echo "checked"; else echo "unchecked"; ?>" />I &amp; O<br/>
   	  <input <?php if (in_array('Daily Weight', $pvitals)) echo "checked"; else echo "unchecked";  ?> name="pVital[]" type="checkbox" id="pVital[]" value="Daily Weight" />Daily Weight<br/>
   	  <input <?php if (in_array('Foley Catheter', $pvitals)) echo "checked"; else echo "unchecked"; ?> name="pVital[]" type="checkbox" id="pVital[]" value="Foley Catheter" />Foley Catheter<br/>
   	  <input <?php if (in_array('other', $pvitals)) echo "checked"; else echo "unchecked"; ?> name="pVital[]" type="checkbox" id="other"  value="other" />Other<br/>
        <input name="pVital[]" type="text" id="whatever"   <?php if (in_array('other', $pvitals)) { ?>  style="visibility: visible;"   <?php } else { ?>    style="visibility:hidden" <?php } ?>  value="<?php if (in_array('other', $pvitals)) echo end($pvitals); ?>">
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster

What you want ?
Want to pass any variables to redirecting page?

divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster

Use following code at beginning of your every php pages

ini_set('error_reporting', E_ALL);
error_reporting ( E_ALL );
divyakrishnan 20 Junior Poster
divyakrishnan 20 Junior Poster

I think this will help you

<!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>Untitled Document</title>
<script>
function edit()
{
 
 
 var ck=document.f.chk;
 if(ck.checked==true)
 {
    document.f.t1.disabled=true;
 }
 else
 {
     document.f.t1.disabled=false;

 
 
 }

}
</script>
</head>

<body>
<form id="form1" name="f" method="post" action="">
  <input name="t1" type="text" id="t1" />
  <input type="checkbox" name="chk" value="checkbox" onclick="edit()"/>
</form>
</body>
</html>
divyakrishnan 20 Junior Poster

Use following expression

+[^\s]

.+ means any character

\s means space character

[^\s] means except space character

karthik_ppts commented: useful +5
divyakrishnan 20 Junior Poster

can u please explain the parameters of the function?