vibhaJ 126 Master Poster

Restart apache and check phpinfo() function for memory_limit field.
You can also set it as -1 for no limits.

vibhaJ 126 Master Poster

If you get the logic for month then exact same way you can do for year also,
in sql query use YEAR function this is example.

vibhaJ 126 Master Poster

Run below query in phpmyadmin sql tab and post output here.
SELECT monthname(local_date) as month FROM tbl_localnews

vibhaJ 126 Master Poster

OOpss..
u_reg_date field is from my testind end, it should be local_date for you.

change

$result = mysql_query("SELECT distinct monthname(u_reg_date) as month FROM tbl_localnews");

to

$result = mysql_query("SELECT distinct monthname(local_date) as month FROM tbl_localnews");
vibhaJ 126 Master Poster

Have you read this :

monthname(u_reg_date) directly gives you month name from database so you dont have to do date('F',strtotime($row))

check this for monthname detail.

for $row, month is not table field but it is alias created for monthname(local_date). I wonder u have not used 'AS' in sql query.

For error, use mysql_num_rows function as shown below whenever you use mysql_fetch_array.

if(mysql_num_rows($result))
	{
		while ($row = mysql_fetch_array($result)) 
		{			
			//.... whatever code....
		}
	}

Post ur result.

vibhaJ 126 Master Poster

Below code will show list of months

<?php	
$result = mysql_query("SELECT distinct monthname(u_reg_date) as month FROM tbl_localnews"); 
while ($row = mysql_fetch_array($result)) 
{	
	print("<br><a href='news.php?month=".$row['month']."'>News for ".$row['month']."</a>");	
}
mysql_free_result($result);
?>

monthname(u_reg_date) directly gives you month name from database so you dont have to do date('F',strtotime($row))

news.php

<?
	$month = $_REQUEST['month'];
	$result = mysql_query("SELECT *,monthname(local_date) as month FROM tbl_localnews where monthname(local_date)='".$month."'  ORDER BY local_date DESC "); 
	echo '<h1>'.$month.'</h1>';
	while ($row = mysql_fetch_array($result)) 
	{			
		print("<p><b>".$row['local_title']."</b></p>");
		print("<p>".$row['local_desc']."</p>");
	}
	mysql_free_result($result);
?>
vibhaJ 126 Master Poster

Thanks. It really works. Can i ask one thing? How am i going to connect this one News for November that it will only display in that month data?

It can be achieved by this code.

<?php	
$last_month = "";
$result = mysql_query("SELECT *,monthname(local_date) as month FROM tbl_localnews ORDER BY local_date DESC limit 0,10"); 
while ($row = mysql_fetch_array($result)) 
{	
	if ($row['month'] != $last_month)
	{
		print("<h2>News for ".$row['month']."</h2>");
		$last_month = $row['month'];
	}
	print("<p><b>".$row['local_title']."</b></p>");
	print("<p>".$row['local_desc']."</p>");
}
mysql_free_result($result);
?>
vibhaJ 126 Master Poster

Here is some modification with ur code...

<?php	
$last_date = "";
$result = mysql_query("SELECT * FROM tbl_localnews ORDER BY local_date DESC limit 0,10"); 
while ($row = mysql_fetch_array($result)) 
{
	if ($row['local_date'] != $last_date)
	{
		print("<h2>News for ".date('F j, Y',strtotime($row['local_date']))."</h2>");
		$last_date = $row['local_date'];
	}
	print("<p><b>".$row['local_title']."</b></p>");
	print("<p>".$row['local_desc']."</p>");
}
mysql_free_result($result);
?>

Try it out.

vibhaJ 126 Master Poster

For changing image follow below steps:
- one php page where user see his/her old uploaded image with browse button.
- when user upload image with browse andf click on update button, on server side in php code check if image is valid.
- if all is set then firstly unlink (delete) old image and upload new image in folder location and use 'update' sql query to update image name in database.

vibhaJ 126 Master Poster

Another option is you use another php page for process of login and use that page name in action of form.

<form action="login_action.php" method="post"><!--if they are not logged in they must do so-->
<table border="0">
<tr><td colspan=2><h1>Login</h1></td></tr>
<tr><td>Email:</td><td>
<input type="text" name="email" maxlength="40">
</td></tr>
<tr><td>Password:</td><td>
<input type="password" name="pass" maxlength="50">
</td></tr>
<tr><td colspan="2" align="right">
<input type="submit" name="submit" value="Login">
</td></tr>
</table>
</form>

login_action.php

<?php
include'database_conn.php';//connect to the database

if (isset($_POST['submit'])) 
{
	//runs if form has been submitted
	if(!$_POST['email'] | !$_POST['pass']) 
	{//makes sure the user has filled the form in
		die('You did not fill in a required field.');
	}
	if (!get_magic_quotes_gpc()) 
	{
		$_POST['email'] = addslashes($_POST['email']);//checks the form against the database
	}
	$check = mysql_query("SELECT * FROM users WHERE email = '".$_POST['email']."'")or die(mysql_error());//gives error is user doesnt exsist
	$check2 = mysql_num_rows($check);
	if ($check2 == 0) 
	{
		die('That user does not exist in our database. <a href=register.php>Click Here to Register</a>');
	}
	while($info = mysql_fetch_array( $check ))
	{
		$_POST['pass'] = stripslashes($_POST['pass']);
		$info['password'] = stripslashes($info['password']);
		$_POST['pass'] = md5($_POST['pass']);
	
		if ($_POST['pass'] != $info['password'])
		{//gives error if the password is wrong
			die('Incorrect password, please try again.');
		}
		else 
		{
			$_POST['email'] = stripslashes($_POST['email']);//if login is ok we add a cookie
			$hour = time() + 3600;
			setcookie(ID_my_site, $_POST['email'], $hour);
			setcookie(Key_my_site, $_POST['pass'], $hour);
			header("Location:account.php");//else redirect them to  account area
			exit;
		}
	}
}

?>
vibhaJ 126 Master Poster

Why dont you directly use file_get_contents instead of fgetcsv.

$StrLessDescription = ("http://nova.umuc.edu/~ct386b##/secret/exercise5/content/lesson5.txt");
$file_contents = file_get_contents($StrLessDescription);
vibhaJ 126 Master Poster

can you debug using below code?

echo $sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; exit;
$result=mysql_query($sql);

post your query in phpmyadmin sql tab, and see what you are getting.
post ur try.

vibhaJ 126 Master Poster

I think

while ($i=0; $i < sizeof($file_contents); $i++);

Should be

for($i=0; $i < sizeof($file_contents); $i++)

'for' and no comma at end.

vibhaJ 126 Master Poster

Use [code] tag in editor to post ur code.

vibhaJ 126 Master Poster

Another thing you can try is serialize data.
1. Create php array with all data you want to save.
2. Serialize that array.Check this for help
3. Save this in database.
4. Retrieve database and unserialize it to use that php array again.check how to unserialize.

Hope this helps....

vibhaJ 126 Master Poster

Firstly crosscheck whether register entry is done in database table or not?
Dude your php coding is in checklogin.php. So post that code...

vibhaJ 126 Master Poster

Generally ur php page should be such that all php coding appears on top of page and before html tags.

The error you are getting because of there is some thing in output before header function executes.
There should be no html tags or blank spaces before header.
I think you have some html tags before login.php included in index.php.

Post index.php code, i will clear your doubt.

vibhaJ 126 Master Poster

check this link.
This will convert xml to php array.
so you can use php array further.

vibhaJ 126 Master Poster

Try this code to check if select query returns at least one row.

<?
$table_first = 'recipe';
$query = "SELECT * FROM $table_first";
$resouter = mysql_query($query, $conn);


$doc = new DomDocument('1.0');
$root = $doc->createElement('recipes');
$root = $doc->appendChild($root);

while($row = mysql_fetch_assoc($resouter)){


$outer = $doc->createElement($table_first);
$outer = $root->appendChild($outer);

 foreach ($row as $fieldname => $fieldvalue) {
    $child = $doc->createElement($fieldname);
    $child = $outer->appendChild($child);
    $value = $doc->createTextNode($fieldvalue);
    $value = $child->appendChild($value);
  }// foreach
 //while
 
//---------------------------- fetch instructions ---------------------------
$table_second='instructions';
$query="SELECT instructions.instruction_id,instructions.instruction_text FROM $table_second where rec_id = ".$row['rec_id'];
$resinner=mysql_query($query, $conn);

$inner = $doc->createElement($table_second);
$inner = $outer->appendChild($inner);
if (mysql_num_rows($resinner) > 0){
while($row = mysql_fetch_assoc($resinner)){
    // add node for each record
    

    $inner1=$doc->createElement('instruction');
    $inner1=$inner->appendChild($inner1);
    // add a child node for each field
    foreach ($row as $fieldname => $fieldvalue) {
        $child = $doc->createElement($fieldname);
        $child = $inner1->appendChild($child);
        $value = $doc->createTextNode($fieldvalue);
        $value = $child->appendChild($value);
    } // foreach
 }}// while


//---------------------------- fetch ingredients ---------------------------
$table_third='ingredients';
$query="SELECT ingredients.ingredient_id,ingredients.ingredient_name,ingredients.ammount FROM $table_third where rec_id = ".$row['rec_id'];
$resthird=mysql_query($query, $conn);

$inner=$doc->createElement($table_third);
$inner=$outer->appendChild($inner);

if (mysql_num_rows($resthird) > 0){
while($row=mysql_fetch_assoc($resthird)){



     $inner2=$doc->createElement('ingredient');
    $inner2=$inner->appendChild($inner2);

    foreach($row as $fieldname=> $fieldvalue)
    {
        $child=$doc->createElement($fieldname);
        $child=$inner2->appendChild($child);
        $value=$doc->createTextNode($fieldvalue);
        $value=$child->appendChild($value);
    }
}}

}

mysql_close($conn);
$xml_string = $doc->saveXML();
echo $xml_string;
?>
vibhaJ 126 Master Poster

Try this code.
Run at ur end and post output.

<?
$table_first = 'recipe';
$query = "SELECT * FROM $table_first";
$resouter = mysql_query($query, $conn);


$doc = new DomDocument('1.0');
$root = $doc->createElement('recipes');
$root = $doc->appendChild($root);

while($row = mysql_fetch_assoc($resouter)){


$outer = $doc->createElement($table_first);
$outer = $root->appendChild($outer);

 foreach ($row as $fieldname => $fieldvalue) {
    $child = $doc->createElement($fieldname);
    $child = $outer->appendChild($child);
    $value = $doc->createTextNode($fieldvalue);
    $value = $child->appendChild($value);
  }// foreach
 //while
 
//---------------------------- fetch instructions ---------------------------
$table_second='instructions';
$query="SELECT instructions.instruction_id,instructions.instruction_text FROM $table_second where rec_id = ".$row['rec_id'];
$resinner=mysql_query($query, $conn);

$inner = $doc->createElement($table_second);
$inner = $outer->appendChild($inner);
while($row = mysql_fetch_assoc($resinner)){
    // add node for each record
    

    $inner1=$doc->createElement('instruction');
    $inner1=$inner->appendChild($inner1);
    // add a child node for each field
    foreach ($row as $fieldname => $fieldvalue) {
        $child = $doc->createElement($fieldname);
        $child = $inner1->appendChild($child);
        $value = $doc->createTextNode($fieldvalue);
        $value = $child->appendChild($value);
    } // foreach
 }// while


//---------------------------- fetch ingredients ---------------------------
$table_third='ingredients';
$query="SELECT ingredients.ingredient_id,ingredients.ingredient_name,ingredients.ammount FROM $table_third where rec_id = ".$row['rec_id'];
$resthird=mysql_query($query, $conn);

$inner=$doc->createElement($table_third);
$inner=$outer->appendChild($inner);
    
while($row=mysql_fetch_assoc($resthird)){



     $inner2=$doc->createElement('ingredient');
    $inner2=$inner->appendChild($inner2);

    foreach($row as $fieldname=> $fieldvalue)
    {
        $child=$doc->createElement($fieldname);
        $child=$inner2->appendChild($child);
        $value=$doc->createTextNode($fieldvalue);
        $value=$child->appendChild($value);
    }
}

}

mysql_close($conn);
$xml_string = $doc->saveXML();
echo $xml_string;
?>
vibhaJ 126 Master Poster

Firstly there should be relation between these three table recipe, instructions and ingredients.
Here you have selected all records in select query rather you should have select query in ingredients for perticular recipe(e.g. 'where' keyword must be there).
post your table structure to make select queries and new code.

vibhaJ 126 Master Poster

If you are privileged user to fetch themes,provider should give you ftp access details.
From php ftp functions you can download themes from them and use it in your website.
Is it works?

vibhaJ 126 Master Poster

If in index.php you are getting all variables then something must be in main.php.
What is the coding in main.php?
If u dnt have code then post any rough steps.

vibhaJ 126 Master Poster

Try all possibilities and post any bug or issue if still exists.

vibhaJ 126 Master Poster

Why dont you write mysql query in index.php itself.
Or post your code, lets see what u r trying with code.

vibhaJ 126 Master Poster

you can fetch HTML view source of that files.
I am not sure what u exactly want,
Do you want to grab theme?
Are that theme provider sites providing facility to use their themes?

vibhaJ 126 Master Poster

You dont have to pass username to included php page.
e.g. test.php

$username = $session->username;
include('function.php');

Once you have $username on test.php, you can use $username in function.php directly.

functions.php

echo "username is ".$username;
vibhaJ 126 Master Poster

session_start must be first line of your code.
<?php session_start();
There should be no blank space or line breaks before this function start.

vibhaJ 126 Master Poster

Hello All,

I think this is server issue, but i thought there are more friends here to help me out.

I have website hosted on fasthost dedicated server of 250GB.
Now server is out of space.I have to increase server capacity to get website running.

I have one another fasthost vitual server of 400GB.
Fasthost have asked us to use this virtual server in website's hosting server.

Do i need to mount?
Do i need to repartition?

I am not sure how to increase hosting capacity as i am not that much aware of linux.
So all server guys please help me out..

vibhaJ 126 Master Poster

Yes, the same code as i write.

Hi Dear,

<?php
$string = "123 4567";
$result = explode(" ", $string);
echo $var_1=$result[0];
echo $var_2=$result[1];
?>

vibhaJ 126 Master Poster

First of all use CODE tag in editor to post your code.
Now when you have modified form with data filled.Add new hidden field with id.
So when you click on update on modify.php page, you can have $id = $_POST;
And you can have update query on that auto id.

<form name="form1" method="post" action="modify.php">
<input type="hidden" name="id" value="56" >
vibhaJ 126 Master Poster

It seems your query is not proper.
Replace ut code with below code to see mysql error.

$query = mysql_query("SELECT * FROM products") or die(mysql_error());
vibhaJ 126 Master Poster

Here is ur code.

<?
	$f1='123 4567';
	$temp = explode(' ',trim($f1));
	$f2 = $temp[0];
	$f3 = $temp[1];
?>
vibhaJ 126 Master Poster

Debug code using printing post array.And post your output.
BTW where is your form tag as this code is partial?

<?
	echo "<table border=1 align=center>";
	echo "<tr>";
	
	while($row = mysql_fetch_array($sellexe)
	{
	echo "<td colspan='3' align='right'><input type='checkbox' name='scow'>Sell"
	}
	echo "<td><input type='submit' name='submit' value='submit'></td>";
	echo "</tr>";
	echo "</table>";
	
	$se = $_POST[scow];
	//cho "$se";
	if(isset($_POST['submit']))
	{
		echo '<pre>';
		print_r($_POST);
		exit;
		
	$inssell = "UPDATE `farmlogin` SET `sellcow` = '$se' WHERE `cowid`='$id'";
	//echo "$inssell";
	$s = mysql_query($inssell);
	} 
?>
vibhaJ 126 Master Poster

You will only have value in $se = $_POST[scow]; if that checkbox is checked and form is submitted.
and value must be there for checkbox field.and whatever is value will be comes in $se. here $se will be 1.

echo "<td colspan='3' align='right'><input type='checkbox' value='1' name='scow'>Sell"
vibhaJ 126 Master Poster

You have to collect all image type extensions icon in one image folder.and rename it as given examples.
e.g.
jpg => jpg_type.png
png => png_type.png
gif => gif_type.png

Store all above image in one folder called 'image'.
Then try below code.

<?
	$imageFile = "imagename.jpg";
	$extAr = explode('.',$imageFile);
	$ext = strtolower($extAr[count($extAr)-1]);
	$iconPath = 'image/'.$ext.'_type.png'; // jpg_type.png
	echo '<img src="'.$iconPath.'" />'.$imageFile;	
?>
vibhaJ 126 Master Poster

Yes. there is no condition for setting session in your code.
So use else for setting session values.

if(isset($_POST['submit']))
{
   $name = mysql_real_escape_string($_POST['username']);
   $pass = mysql_real_escape_string($_POST['password']); 
   $mysql = mysql_query("SELECT * FROM users WHERE name = '{$name}' AND password = '{$pass}'"); 
   if(mysql_num_rows($mysql) < 1)
   {
     echo("<center>Password was an epic fail!</center>");
   } 
   else
   {
	   $_SESSION['loggedin'] = "YES"; 
	   $_SESSION['name'] = $name; 
	   echo("<center>W00p we have success!   <a href='acp.php'>Proceed to heaven</a></center>"); 
   }
}
vibhaJ 126 Master Poster

I was thinking its only about aphostophe.
But you can not show HTML code in textfield.

If you want to edit HTML part, use ckeditor.
If you will use ckeditor editor your problem will be solved.
Check with link if it helps you.

vibhaJ 126 Master Poster

Here is a query.
Try it.

SELECT teams.name, count( teams.name )
FROM teams
LEFT JOIN schedule ON schedule.team1 = teams.name
OR schedule.team2 = teams.name
WHERE schedule.id >0
GROUP BY teams.name
ORDER BY rand( )
LIMIT 0 , 10
vibhaJ 126 Master Poster

this is comman file, which will be included in your all php files.So you dont have to write this files code in all files.

vibhaJ 126 Master Poster

Trial nd error code :

$desc= htmlentities($selectproda[description]);
echo "<input type='textarea' rows='8' cols='80' name='desc-uprod' value='".$desc."' />";

this worked for me.. check at ur end.

vibhaJ 126 Master Poster

just check with data stored in your database and post it here based on that we will make code.

vibhaJ 126 Master Poster

mapping means relation.
e.g.
tbl_upload => id,title,date,image, author_id
tbl_author => id, author

Here author_id from tbl_upload is foreign key from tbl_author's id.

Even above code should display authors.
check SELECT * FROM `tbl_author` query with phpmyadmin. Is table have any records?

vibhaJ 126 Master Poster

Try this code.

<?
$produpd = $_POST['id-uprod'];

$selectprod=mysql_query("SELECT * FROM products WHERE id='$produpd'");
$selectproda=mysql_fetch_array($selectprod);
$desc= stripslashes($selectproda[description]);

echo "<table border='2' cellspacing='15' cellpadding='15'>";
echo "<tr><td>";
echo "<form action='updatedprod.php' method='post' class='text'>";
echo "<input type='hidden' name='id-uprod' value='$selectproda[id]' />";
//echo ($presstext['id']);
echo "</td></tr><tr><td>";
echo "<input type='text' name='name-uprod' value='$selectproda[name_product]' />";
echo "</td></tr><tr><td>";
echo "$test";
echo "<input type='textarea' rows='8' cols='80' name='desc-uprod' value='".$desc."' />";
echo "</td></tr><tr><td>";
echo "<input type='text' name='price-uprod' value='$selectproda[price]' />";

?>

I think mysql_real_escape_string should be used to just insert data in database not to fetch.

vibhaJ 126 Master Poster

nextdate your both post are totally different.
POst your exact question with code and error you are getting.
BTW use [ code ] tag given in editor to post your code.

vibhaJ 126 Master Poster

Try below code.
But why r u fetching all data from tbl_author table?
There should be some mapping between tbl_upload and tbl_author.

<html>
<body>
<form method=post action="find.php">
	<h2>Search For:</h2>
	<p> Academic Year :
		<input type=text name=search size=9 maxlength=9>
	<p>
		<input type=submit name=submit value=List>
		<input type=reset name=clear value=cancel>
</form>
</body>
</html>
<?php

if(isset($_POST['submit']))
{
	include 'conn.php';
	
	$search=$_POST['search'];
	$sy=explode('-',$search);
	
	
	$result = mysql_query ("SELECT * FROM `tbl_upload` WHERE (`year` >= $sy[0] AND `year` <= $sy[1])");
	echo '<h2>Result</h2>';
	if (mysql_num_rows($result) > 0) 
	{ 
		while($row = mysql_fetch_array($result))
		{
	
			  echo "<b>Title:</b>"; 
			  echo '<a href="">'.$row["title"].'</a>'; 
			  echo "<br>";
	
			  $result2 = mysql_query ("SELECT * FROM `tbl_author`");
			  if ($row2 = mysql_fetch_array($result2)) 
			  {
			  		echo "<b>Author:</b>"; 
					echo $row2["author"]; 
					echo "<p>";
			  }
		}						
	} 
	else 
	{
		echo 'Sorry, no records were found!';
	}   

}

?>
vibhaJ 126 Master Poster

Try below code.
Here i have used session to remember previous items.

<? session_start();?>
<title> SALES </title>
<body>
<form action="index.php" method="post">
ENTER ID: <input type="text" name="item" />
<input type="submit" name="submit" value="submit"/>
<input type="submit" name="refresh" value="refresh" meta http-equiv="refresh" />
</form> 



<?php
include("connection.php");

if(isset($_POST['submit'])){
$sel_item = $_POST['item'];
$query  = "SELECT * FROM items where {$sel_item} = id";
$result = mysql_query($query) or die();
echo "<table>";
echo "<tr><th>ID</th> <th>ITEM NAME</th> <th>DESCRIPTION</th> <th>SIZE</th> <th>COLOR</th> <th style='text-align:right'>PRICE</th> <th style='text-align:right'>QUANTITY</th></tr>";

while($row = mysql_fetch_array($result)) {
	
	echo"<tr><td>";
	echo $row['id'];
	echo"</td><td>";
	echo $row['item_name'];
	echo"</td><td>";
	echo $row['description'];
	echo"</td><td>";
	echo $row['size'];
	echo"</td><td>";
	echo $row['color'];
	echo"</td><td style='text-align:right'>";
	echo "P".$row['price'];
	echo"</td><td style='text-align:right'>";
	echo $row['quantity'];
	echo "</td><td>";
		
}
echo "</table>";
}
?>



<br/><br/>
<h1>SALES</h1>
<form action="index.php" method="post">
<table width="400">
<tr>
<td> ID: <strong><?php echo $sel_item ?></td>
</tr>
<tr>
<td> QUANTITY: </td><td><input type="text" name="quantity"/></td>
<td> <input type="submit" name="add" value="add" ></td>
</tr>

<?php
//include("connection.php");
$total=0;
if(isset($_POST['add'])){
$selc_item = $_POST['selc_item'];
$item_quantity = $_POST['quantity'];
$query  = "SELECT * FROM items where {$item_quantity} <= quantity ";
$result = mysql_query($query) or die();
$row = mysql_fetch_array($result);
$item_name = $row[1];
$item_price = $row[5];
$t_item_price = $row[5] * $item_quantity;

$cnt = count($_SESSION['master']);
$cnt++;
$_SESSION['master'][$cnt]['selc_item'] = $selc_item;
$_SESSION['master'][$cnt]['item_name'] = $item_name;
$_SESSION['master'][$cnt]['item_quantity'] = $item_quantity;
$_SESSION['master'][$cnt]['item_price'] = $item_price;
$_SESSION['master'][$cnt]['t_item_price'] = $t_item_price;		
}

if(count($_SESSION['master']) > 0 )
{
	echo"<table>";
	echo"<tr>";
	echo"<th>ID</th><th>ITEM NAME</th><th>QUANTITY</th><th>PRICE</th><th>TOTAL PRICE</th><th></th></tr>";
		
		for($i=0;$i<count($_SESSION['master']);$i++)	
		{
			echo"<tr>";
			echo"<td>".$_SESSION['master'][$i]['selc_item']."</td>";
			echo"<td>".$_SESSION['master'][$i]['item_name']."</td>";
			echo"<td>".$_SESSION['master'][$i]['item_quantity']."</td>";
			echo"<td>".$_SESSION['master'][$i]['item_price']."</td>";
			echo"<td>".$_SESSION['master'][$i]['t_item_price']."</td>";
			echo"</tr><br />";
		}
		
	echo"</table>";
}
?>
</form>
</html>
vibhaJ 126 Master Poster

use button element instead of submit.
Then your js function will run.

<form id="form1" name="form1" method="post" action="PaymentFormProcess.php">
    <table width="80%" align="center">
      <tr>
        <td width="43%"><strong>Do you accept these terms and conditions?</strong></td>
        <td width="29%" align="right"><p>
          <label>
            <input type="radio" name="TermsConditions" value="Accept" id="TermsConditions_0" />
            I Accept</label>          
        </p></td>
        <td width="28%" align="right"><label>
          <input type="radio" name="TermsConditions" checked="checked" value="Decline" id="TermsConditions_1" />
          I do not Accept</label>
        </td>
      </tr>
</table>
    <label for="ConfirmBooking">Confirm Booking:</label>
            <input type="button" name="ConfirmBooking" id="ConfirmBooking" value="Confirm Booking" onclick="Accept()" />      
    </form>
vibhaJ 126 Master Poster

This comment will help u to understand.

<?
	function mapString($str,$ch)
	{	
		$string_length = strlen($str); //e.g. length is 162
		
		if(strlen($str) < $ch) // if length is less than 160 return 1
		{	return 1; } 
		
		$ratio = $string_length/$ch ; // so ratio will be 162/160 => 1.33
		return floor($ratio); // round 1.33 to 1
	}
	$text = "your text goes here.";
	echo mapString($text,160);
?>
ahmedeqbal commented: helpful reply...! nice guy +2
vibhaJ 126 Master Poster

Here is code:

<?
	function mapString($str,$ch)
	{	
		return floor(strlen($str)/$ch);
	}
	$text = "your text goes here.";
	echo mapString($text,160);
?>