vibhaJ 126 Master Poster

When your form is submitted use urlencode in following way before inserting into database.

$comment = urlencode($_POST['comment']);

I think it should not cutoff with &amp, What is field type of comment in database?

vibhaJ 126 Master Poster

Where is settings.inc.php in included?
In index.php OR includes.inc.php?
And what is the order of include coding?

vibhaJ 126 Master Poster

Okay.. i end up with this logic.
There is one hidden field named form_html. When admin click on save button using jquery i am getting html inside form tag and setting it in hidden variable.
After submitting in php side i have used one html parser class, which will filter all attributes and saving it into database.

vibhaJ 126 Master Poster

Check this code.

<? session_start();
   $sendAfter = (10)*(60); // in seconds 
   $sendEmail = false;
    $now = date('Y-m-d H:i:s');
	
   if(!isset($_SESSION['sent_time'])) // if you are first time send email
   { 
		$sendMail = true;
		$_SESSION['sent_time'] = $now;
   }
   else
   {	
	   $diff = strtotime($now) - strtotime($_SESSION['sent_time']);
	   if($diff >= $sendAfter)// if difference is more than 10 min then only send mail
	   {
	   		$sendMail = true;
			$_SESSION['sent_time'] = $now;
		}
	}
	
	if($sendMail)
		echo "mail sending code here";
	else
		echo "nothing to do";

?>
karthik_ppts commented: useful post +6
vibhaJ 126 Master Poster

If you just need image in email body then create email body string which contain img tag.

<?php 
emailBody = '<img src="http://images.daniweb.com/logo.gif" />';
?>

Check this example for help : http://in.php.net/manual/en/function.mail.php#example-2935

vibhaJ 126 Master Poster

I have fixed this from below help :
workaround when using session variables in a .php file referred by a frame (.html, or other file type) at a different server than the one serving the .php:

Place this header on the .php file that will create/update the session variables you want:

<?php header('P3P: CP="CAO PSA OUR"'); ?>
Texts from http://us.php.net/function.session-start

vibhaJ 126 Master Poster

I am facing this issue again..So i am posting on this old thread.
I think its nothing related to phpmyadmin. May be my first question was unclear.
My question is how can we stop browser to ask "do you want to remember password?" when we have <input type="password" in form. Default when i enter username and password browser always ask to remember it.

vibhaJ 126 Master Poster

I like fileZilla, its facility of folder synchronization, success-error logs etc is good.
But as it is saving password in xml file so there may be possibility of hacking.
I have seen that there are some unnecessarily iframe tags are added in index file. May be its bcz of i have saved password in fileZilla.

vibhaJ 126 Master Poster

@ardav: thanks for db setup.
But i am looking for some different point.

for example take a look on this link : http://www.phpform.org/formbuilder/index.php
Here i can create dynamic form by adding fields from top.
Now i want to save all created form fields, labels, values to database.
How can i post all values to php page.bcz form will only post input field name and values.
But i need labels, attributes, options of dropdown ..etc.

vibhaJ 126 Master Poster

Hi Friends,

I am working on php from builder, where user can add text-box, text-area, chekbox, radio-button etc field using jQuery.
Now i am ready with html code of form. Next step is to save each attributes(i.e. name, optionstags, label, title, tooltip, class etc) in mysql database.
How can i store each values in database using jQuery or PHP ?
I have checked jquery serialized function but that will just return values of input field.
Need your help or suggestions guys.

Thanks,
Vibha

vibhaJ 126 Master Poster

This is what i checked..
Not sure for browser compatibility...

<!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=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
.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;
	display:none;	
}
.messText:first-child
{	
	display:block;	
}
</style>
</head>

<body>
this is starting..<br />
this is starting..<br />
this is starting..<br />
this is starting..<br />
<div>
<?
	if ($num_rows == 0) {
	echo '<div class="messText">Sorry, your postcode could not be found - Please try again!</div>';
}
?>
<?php echo '<div class="messText">Please click on the Continue button below to view your Times.</div>'; ?>
</div>
</body>
</html>

CSS indicates that all .messText are default invisible and only first child is visible.
Make sure there must be one common parent <div> for both message divs.

vibhaJ 126 Master Poster

You can also do it by using ternary operator.

<? 
echo '<td>
echo <select name="type"><option value=" ">select the type</option><option value="C" "'.((trim($_POST['ctype2'])=="C")?('selected'):('')).'">Calcium</option><option value="V">Vitamin</option></td>
 </tr>';
?>
vibhaJ 126 Master Poster

You can use base64_encode function to encode text or id.

echo "<a href='reject.php?name=".base64_encode($name)."&officerid=".base64_encode($pofficerid)."&officername=".base64_encode($pofficername)."&txt1=".base64_encode($ss)."'>Reject</a>";

On reject.php you can decode it back.

$name = base64_decode($_GET['name']);

But i advice to pass only one id, and then on reject.php fetch rest data from database using id.

vibhaJ 126 Master Poster

Why do you want two separate table?
You can have only one table and use number of TD you want.
Make loop proper for closing each TD & TR.

vibhaJ 126 Master Poster

You need php class which can do all database related stuff.
check this link http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/, it's nice tutorial you can go through it.

vibhaJ 126 Master Poster

Generally if form post some data on any page, better you do all db related operations or other php coding at top of page and then redirect user to some page using header.

header('Location:index.php');

without header you may face problem.
e.g. if user POST data and you have insert query in database and if you won't have header then each time user press refresh there will be record inserted in database every time.

vibhaJ 126 Master Poster
vibhaJ 126 Master Poster

Is this like a POLL?
Check this link http://www.codeproject.com/KB/HTML/phpoll.aspx
Try to build some logic and start working on coding part.

vibhaJ 126 Master Poster

Mark thread solved !

vibhaJ 126 Master Poster

check this 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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
function check(theForm)
{
	
	var checker;
	var checkbox = document.getElementById("tacBox");
	if (checkbox.checked)
	{
		document.getElementById("myCheckBox").innerHTML = '<div id="mustCheck"> </div>';; // changes the innerHTML to equal the adder
		checker = true;		
	}
	else
	{
		document.getElementById("myCheckBox").innerHTML = '<div id="incorrect"> ***YOU MUST ACCEPT THE TERMS AND CONDITIONS*** </div>';		
		checker = false;		
	}
	return checker;
}
</script>
</head>

<body>
<form name="form" id="form" onsubmit="return check(this);" >
<input id="tacBox" name="tacBox" type="checkbox" value="1" /> check box

<span id="myCheckBox"></span>
<input name="submit" value="submit" type="submit" />
</form>
</body>
</html>
vibhaJ 126 Master Poster

Hope ID is auto increamented and primary field.
When you insert new record then its id is greater than prev.
thus if you search all results with one date and see MAX(ID), it returns last inserted row for that date.

vibhaJ 126 Master Poster

Try with quote.

SELECT * FROM `date` WHERE date BETWEEN '2011-01-01' AND '2011-12-31'
vibhaJ 126 Master Poster

Below is not a complete code,it is just a logic.
Try to implement at your end.

<select name="dropd" id="dropd">
<option value=""> - - Select - -</option>
<? 
if(manager is logged in)
{
	$res = select manager list from database
	while($rs = mysql_fetch_assoc($res))
	{
?>
	<option value="<?=$rs['manager-id']?>"><?=$rs['manager-name']?></option>
<?
	}
}
if(employee is logged in)
{
	$res = select employee list from database
	while($rs = mysql_fetch_assoc($res))
	{
?>
	<option value="<?=$rs['employee-id']?>"><?=$rs['employee-name']?></option>
<?
	}
}
?>
</select>
vibhaJ 126 Master Poster

Second approach is good. BTW m not MAN, m MISS :)

vibhaJ 126 Master Poster

Okay.. check later and post result.

vibhaJ 126 Master Poster

What about this code:

<? 
	$isChecked = 1; // change it to 0 and then run
?>
<script language="javascript">
		function Toggle(id,chk) 
		{
			if(chk)
			{
				document.getElementById(id).style.display = "block";
			} 			
			else 
			{
				document.getElementById(id).style.display = "none";
			}
		}
</script>

	<input type="checkbox" name="" <?=($isChecked == 1)?('checked'):('');?> onclick="Toggle('test01',this.checked)" /> Yellow Box<br />

	<div id="test01" style="display:<?=($isChecked == 1)?('block'):('none');?>;">
		This should show up when you click Yellow Box. And it should go away when you click it again.
	</div>
vibhaJ 126 Master Poster

what is html code of drop down boxes?
you need to give value to option tag e.g.

<option value="2200">2200</option>
vibhaJ 126 Master Poster

Here is a link for dynamic password generator using JS.
http://javascript.internet.com/passwords/random-password-generator.html

vibhaJ 126 Master Poster
vibhaJ 126 Master Poster

Normally this error comes in pc if file you are trying to access is already used by some another app.
You mean to say when you copy paste some html tag this error comes?

vibhaJ 126 Master Poster

Check if sessions are displaying on the same page or not?

<?php
session_start();
$_SESSION['color']='red';
$_SESSION['size']='small';
$_SESSION['shape']='round';
echo '<pre>';
print_r($_SESSION); 
?>
vibhaJ 126 Master Poster

What about this:

$sql="SELECT TOTALMW,TOTALMVAR,ID FROM generators 
WHERE date='2011-08-11' // search with date
ORDER BY ID desc limit 0,1";
vibhaJ 126 Master Poster
<?
	$links = array(
	 array("url"=>"...first.php","label"=>"first"),
	 array("url"=>"...second.php","label"=>"second"),
	 array("url"=>"...third.php","label"=>"third"),
	 array("url"=>"...fourth.php","label"=>"fourth")
	);
	$link = $links[array_rand($links)];	
	echo "<ul>";
	echo "<li><a href=\"{$link['url']}\">{$link['label']}</a></li>";	
	echo "</ul>";
?>
vibhaJ 126 Master Poster

Ohhh... you have same code 6 times..Is this code by you?
for debugging echo sql query and run it directly in database and check if you are getting desired result.

echo $sql="SELECT * from generators WHERE  convert(datetime,convert(char(10),TIMESTOMPX,101))= '$search'";
exit;
vibhaJ 126 Master Poster
vibhaJ 126 Master Poster
vibhaJ 126 Master Poster

Once your first row is displayed second row should be in next line.
something like

<?
		$rowCnt = 6;
		while($row1 = mysql_fetch_array($this->result))
 		{
			$this->Cell($w[0], $rowCnt, $row1['tran_id'], 0, 'L', $fill);
			$this->Cell($w[1], $rowCnt, $row1['account_number'], 'LR', 0, 'R', $fill);
			$this->Cell($w[2], $rowCnt, $row1['transaction_type'], 'LR', 0, 'L', $fill);
			$this->Cell($w[3], $rowCnt, $row1['transaction_amount'], 'LR', 0, 'L', $fill);
			$this->Cell($w[4], $rowCnt, $row1['transaction_date'], 'LR', 0, 'L', $fill);
			$this->Cell($w[5], $rowCnt, $row1['approved_status'], 'LR', 0, 'L', $fill);
			$fill=!$fill;
			$rowCnt++ ;
		}
?>
vibhaJ 126 Master Poster

I have changed code..
Will it work?

<?
	$error = 'continue';
	if ($num_rows == 0)
	{
		$error = 'postcode';		
	}
?>
<td align="center" valign="center"><br/>
	
	<?php
		if($error == 'continue')
			echo '<div class="messText">Please click on the Continue button below to view your Times.</div>'; 
		if($error == 'postcode')
			echo '<div class="messText">Sorry, your postcode could not be found - Please try again!</div>';
	?>
</td>
vibhaJ 126 Master Poster

Oh.. i forget you already posted html code on first post..
Can you try below one..
Use any static date which is there in database and post output..

<?php

require_once('../config/lang/eng.php');
require_once('../tcpdf.php');

// extend TCPF with custom functions
class MYPDF extends TCPDF {

    public function myconnection(){
	$this->con = mysql_connect("localhost","root",""); 
	
	mysql_select_db("bank", $this->con);
	
	$date = '2011-08-11'; // use any date which is there in database
$this->result = mysql_query("SELECT * FROM transaction WHERE transaction_date = '".$date."' ORDER BY tran_id") or die( '<strong>Error: </strong>'. mysql_errno().':'.mysql_error());
vibhaJ 126 Master Poster

Yes cereal, try this:
RewriteRule ^([^/]*)$ /profil.php?user=$1 [L]

vibhaJ 126 Master Poster

1) Check spelling of table name. once you have "cek1a" and second is "cekla".
2) if spell is proper and still its not working then add below code on top of test2.php and post output.

echo '<pre>';
print_r($_POST['delete']);
exit;
vibhaJ 126 Master Poster

Hi Newbie,
Check this link
http://www.daniweb.com/web-development/php/threads/369623/1588766#post1588766
it will guide you how string concatenation works in php.

vibhaJ 126 Master Poster

Why are you giving position?
Try without position: absolute;

vibhaJ 126 Master Poster

for dot try below rule if it works.

RewriteRule ^([^_]*)$ ./profil.php?user=$1
vibhaJ 126 Master Poster

Post the html code where you have form fields.

vibhaJ 126 Master Poster

Try

$date = $_POST['date'];

instead of

$date = var_dump($_POST['date']);

And also make sure date should be in proper format i.e. 20011-08-20

vibhaJ 126 Master Poster

Firstly use CODE tags for posting ur code.
What is working in ur code and what is not working??
Are you not able to generate xml?
Here is a link to add markers using xml. http://econym.org.uk/gmap/basic3.htm

vibhaJ 126 Master Poster

There will be some example files.
Below is url from my PC.
http://localhost/phpmailer/examples/test_smtp_gmail_basic.php

Below is code in test_smtp_gmail_basic.php.
Place your gmail username and password.
Make sure openssl extension should be available.

<html>
<head>
<title>PHPMailer - SMTP (Gmail) basic test</title>
</head>
<body>

<?php

//error_reporting(E_ALL);
error_reporting(E_STRICT);

date_default_timezone_set('America/Toronto');

require_once('../class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail             = new PHPMailer();

$body             = file_get_contents('contents.html');
$body             = eregi_replace("[\]",'',$body);

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "mail.yourdomain.com"; // SMTP server
$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages only
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 465;                   // set the SMTP port for the GMAIL server
$mail->Username   = "yourusername@gmail.com";  // GMAIL username
$mail->Password   = "yourpassword";            // GMAIL password

$mail->SetFrom('name@yourdomain.com', 'First Last');

$mail->AddReplyTo("name@yourdomain.com","First Last");

$mail->Subject    = "PHPMailer Test Subject via smtp (Gmail), basic";

$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);

$address = "whoto@otherdomain.com";
$mail->AddAddress($address, "John Doe");

$mail->AddAttachment("images/phpmailer.gif");      // attachment
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}

?>

</body>
</html>
vibhaJ 126 Master Poster
<script language = "Javascript">
function isValidNumber(str)
{
	var tomatch= /^[0-9]{10}$/		
	if(tomatch.test(str))    
		return true;	
	else
		return false;    
}
function Validate()
{
    function validateEmail(f){
	if(isEmail(f.email.value)==false)
	{
	alert('Please enter a valid email address');
	f.email.select();
	return false;
	}
	return true;
	}
	function isEmail(string){
	if(string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z-0-9]+((\.|-)[A-Za-z-0-9]+)*\.[A-Za-z-0-9]+$/)!=-1)
	return true;
	else
	return false;
	}
	
	if (document.form1.first_name.value == '') 
    {
        alert('Please fill in your first name!');
        return false;
	}	
	if(!document.form1.first_name.value.match(/^[a-zA-Z]+$/)){
	    alert('Please enter only string values!');
		return false;
	}
	if (document.form1.last_name.value == '') 
    {
        alert('Please fill in your last name!');
        return false;
    }
	if(!document.form1.last_name.value.match(/^[a-zA-Z]+$/)){
	    alert('Please enter only string values!');
		return false;
	}	
    if (isEmail(document.form1.email.value) == '') 
    {
       alert('Please enter a valid email address!');
       return false;
    }
	if (document.form1.phone_number.value == '') 
    {
        alert('Please fill in phone number!');
        return false;
    }
	else
	{
		if(!isValidNumber(document.form1.phone_number.value))
		{
	   		alert('Please enter only numbers');
	   		return false;
		}   
	}	    
    if (document.form1.user_type.value == '') 
    {
        alert('Please fill in your user type!');
        return false;
    }
    if (document.form1.username.value == '') 
    {
        alert('Please fill in your desired username!');
        return false;
    }
    if (document.form1.password.value == '') 
    {
       alert('Please fill in your desired password!');
      return false;
    }
    if (document.form1.confirm_password.value == '') 
    {
       alert('Please fill in your password again for confirmation!');
      return false;
    }
    if (document.form1.password.value != 
    document.form1.confirm_password.value) 
    {
        alert("The two passwords are not identical! "+
        "Please enter the same password again for confirmation");
        return false;
    }
    
    return true;
}
</script>
vibhaJ 126 Master Poster
function validNumber(str)
{
	var tomatch= /^[0-9]{10}$/		
	if(tomatch.test(str))    
		return true;	
	else
		return false;    
}