Bachu 45 Newbie Poster

Try This

<!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>Form -  validate - Exg</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<form  method="post" name="myForm">

    <span class="formError email">Please Enter Valid Email</span>

    <input type="text" name="Email" id="email" onKeyUp="checkEmail()" />

    <input type="submit" value="Send" name="submitButton" />
</form>
<style>
.formError{  display:none; }
</style>
<script type="text/javascript">
function checkEmail(){  
   var email = $("#email").val();
    var atpos=email.indexOf("@");
    var dotpos=email.lastIndexOf(".");
    if(email=='') $('.email').show();
    else if (atpos<1 || dotpos<atpos+2 || dotpos+2>=email.length)  $('.email').show();
    else $('.email').hide()
}

</script>
</body>
</html>
Bachu 45 Newbie Poster

Try this Exg :

<!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>Table Exg</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>

<body>
<table id="myTable" width="200px" cellpadding="0px" cellspacing="0px">
  <tr>
    <td>One</td>
    <td>Two</td>
    <td>Three</td>
  </tr>
  <tr>
    <td>1</td>
    <td>2</td>
    <td>3</td>
  </tr>
</table>
<script type="text/javascript">
$(function(){
    $('#myTable').mouseover(function() {
        $(this).css('text-align','center');
        $(this).css('border','1px solid');
        $(this).css("background-color","#FF0000");
    });

    $('#myTable').mouseout(function() {
        $(this).css('text-align','left');
        $(this).css('border','0px');
        $(this).css("background-color","#FFFFFF");
    });
});
</script>

</body>
</html>
Bachu 45 Newbie Poster

change this

<div class="Page page1" style="display: none;">
<h1>Gallery-1</h1>
</div>

To

<div class="Page page1" style="display: block;">
<h1>Gallery-1</h1>
</div>
Bachu 45 Newbie Poster

Change this

$('.Page').fadeOut();
$('.page'+divIndex).fadeIn();

To

$('.Page').hide();
$('.page'+divIndex).show();
Bachu 45 Newbie Poster

Use Jquery ..
Try this ..
Exg:

<!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>Gallery Exg</title>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>

<body>
<a href="#page1" class="link" rel="1">pic1</a>
<a href="#page2" class="link" rel="2">pic2</a>
<div class="Page page1" style="display: none;">
<h1>Gallery-1</h1>
</div>
<div class="Page page2" style="display: none;">
<h1>Gallery-2</h1>
</div>
<script type="text/javascript">
$(function(){
    $('.link').click(function() {
        var divIndex = $(this).attr('rel');
        $('.Page').fadeOut();
        $('.page'+divIndex).fadeIn();
    });
});
</script>

</body>
</html>
Bachu 45 Newbie Poster

Try this

http://code.google.com/p/dompdf/

include_once("dompdf/dompdf_config.inc.php");
$dompdf= new DOMPDF();

    if(isset($_REQUEST['txtContent'])){
        $content='';
        $content.='<!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>
</head><html><body>';
        $content.=$_REQUEST['txtContent'];
        $content.='</body></html>';
        if(empty($content)) {
            $error="Please enter contents";     
        }
        else {
            $fileName=$_REQUEST['fileName'].'.pdf';
            $dompdf->load_html($content);
            $dompdf->render();
            $dompdf->set_paper(array(0,0,900,800));
            $dompdf->stream($fileName);
        }
    }
Bachu 45 Newbie Poster

First you check, is posted file exist or not

EXg:

$yourFile = "uploads/".$_POST['selectBoxName'];
$checkFile = fopen($yourFile, 'w') or die("can't open file");
fclose($checkFile);

If file exist, then

unlink($yourFile);
Bachu 45 Newbie Poster

Make sure that , field names country_id and product_id are same as country_wise_products table fields..

Bachu 45 Newbie Poster

Check this

<?php

if (isset($_POST['Submit'])) {

$pro_name = $_POST['product_name'];
$pro_reg_date = $_POST['regstr_date'];
$renewal_date = $_POST['renewal_date'];
$product_shelf = $_POST['pro_shelf_life'];
$countries = $_POST['country'];



$Id=(@mysql_result(@mysql_query("SELECT max(product_id) from products"),0,0)+1);
$c_Id=(@mysql_result(@mysql_query("SELECT max(country_id) from country"),0,0)+1);
$c_w_id = (@mysql_result(@mysql_query("SELECT max(c_w_p_id) from country_wise_products"),0,0)+1);

$sql1 = "INSERT INTO products (product_id, product_name, pro_regt_date, pro_renew_date, product_shelf_life) VALUES 
('$Id', '$pro_name', '$pro_reg_date', '$renewal_date', '$product_shelf')";
$sql1_result = mysql_query($sql1) or die (mysql_error());

if(isset($_POST['country'])) {
$cLists = array();
$cLists = $_POST['country'];
$product_id = $Id;

foreach($cLists as $country_id) {
$query = "INSERT INTO country_wise_products (coutry_id, product_id) VALUES  ($country_id, $product_id)";
mysql_query($query);
}
}

}
?>

<!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>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>

<body>
<form name="pro_reg_form" id="form1" method="post" action="">
  <table width="40%"  border="1" align="center" cellpadding="0" cellspacing="0">
    <tr align="center">
      <td colspan="2">Product Regisration Tracker</td>
    </tr>
    <tr>
      <td>Product Name </td>
      <td><input name="product_name" type="text" id="product_name" /></td>
    </tr>
    <tr>
      <td>Product Regsiterd Date </td>
           <td><input name="regstr_date" type="text" id="regstr_date" /></td>
    </tr>
    <tr>
      <td>Product Renewal Date </td>
      <td><input name="renewal_date" type="text" id="renewal_date" /></td>
    </tr>
    <tr>
      <td>Product Shelf Life </td>
      <td><input name="pro_shelf_life" type="text" id="pro_shelf_life" /></td>
    </tr>
    <tr>
      <td valign="top">Country</td>
       <?php $stqry = "select * from country order by country_name"; 
                        $cat_rs = mysql_query($stqry); ?>

      <td><select name="country[]" multiple="multiple" id="country">
      <?php 
                            while ($cat_row = @mysql_fetch_object($cat_rs)) {
    echo "<option value='".$cat_row->country_id."'>".$cat_row->country_name."</option>";
    }?>
      </select> 
      </td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit" value="Register" /></td>
    </tr>
  </table>
</form>
</body>
</html>
Bachu 45 Newbie Poster

Check this

else {

// form submitted 
// set server access variables 
$host = "localhost"; 
$user = "root"; 
$pass = ""; 
$db = "books";

$search = empty($_POST['search'])? die ("ERROR: Enter Search Criteria") : mysql_escape_string($_POST['search']); 
$dropdown = empty($_POST['dropdown'])? die ("ERROR: Select from dropdown") : mysql_escape_string($_POST['dropdown']);

// Open Connection

$connect = mysql_connect($host, $user, $pass) or die ("Unable to connect to host");

//Select Database

mysql_select_db($db) or die ("Unable to connect to database");

//Create Query

$query = "SELECT * FROM books WHERE $dropdown='$search'" or die (mysql_error());

$result = mysql_query($query) or die (mysql_error());

$num=mysql_numrows($result);

mysql_close($connect);

echo "<b><center>Search Results of Bounced Checks</center></b><br><br>";

echo "<table width = '1000' align = 'center' border ='1'>";

echo "<tr><td>Check ID</td><td>Transaction Date</td><td>Store Name</td><td> Check Date</td><td>Date Cashed</td><td>Date Return</td><td>Check Number</td><td>Maker Name</td><td>Payee Name</td><td>Bank Name</td><td>Check Amount</td><td>Return Reason</td><td>Date Solved</td><td>Redeposited</td><td>Replacement</td><td>Paid Cash</td><td>Balance</td><td>Disposition</td></tr>";


$i=0; 
while ($i < $num) {

$bookid=mysql_result($result,$i,"bookid"); 
$transactiondate=mysql_result($result,$i,"transactiondate"); 
$storename=mysql_result($result,$i,"storename"); 
$checkdate=mysql_result($result,$i,"checkdate"); 
$datecashed=mysql_result($result,$i,"datecashed"); 
$datereturn=mysql_result($result,$i,"datereturn"); 
$checknumber=mysql_result($result,$i,"checknumber"); 
$makername=mysql_result($result,$i,"makername"); 
$payeename=mysql_result($result,$i,"payeename"); 
$bankname=mysql_result($result,$i,"bankname"); 
$checkamount=mysql_result($result,$i,"checkamount"); 
$returnreason=mysql_result($result,$i,"returnreason");
$datesolved=mysql_result($result,$i,"datesolved");
$redeposited=mysql_result($result,$i,"redeposited");
$replacement=mysql_result($result,$i,"replacement");
$paidcash=mysql_result($result,$i,"paidcash");
$balance=mysql_result($result,$i,"balance");
$disposition=mysql_result($result,$i,"disposition");

echo "<tr>";
            echo "<td>".$bookid."</td>";
            echo "<td>".$transactiondate."</td>";
            echo "<td>".$storename."</td>";
            echo "<td>".$checkdate."</td>";
            echo "<td>".$datecashed."</td>";
            echo "<td>".$datereturn."</td>";
            echo "<td>".$checknumber."</td>";
            echo "<td>".$makername."</td>";
            echo "<td>".$payeename."</td>";
            echo "<td>".$bankname."</td>";
            echo "<td>".$checkamount."</td>";
            echo "<td>".$returnreason."</td>";
            echo "<td>".$datesolved."</td>";
            echo "<td>".$redeposited."</td>";
            echo "<td>".$replacement."</td>";
            echo "<td>".$paidcash."</td>";
            echo "<td>".$balance."</td>";
            echo "<td>".$disposition."</td>";


echo "</tr>";
$i++;
} 
echo "</table>";
} 
?>

</body> 
</html> 
Bachu 45 Newbie Poster

Try this

<?php
$sqlsearch = mysql_query("SELECT * FROM tblteacher_info WHERE Fname='$iFName' AND Mname='$iMName' AND Lname='$iLName'",$open_con);
    if(!$sqlsearch)
        {
            die("Database connection failed:" . mysql_error());
        }

else {
            if(mysql_num_rows($sqlsearch)>0) {

                $i_sqlupdate = mysql_query("UPDATE tblteacher_info SET Fname='$iFName', Mname = '$iMName', Lname = '$iLName', Username ='$username', Password='$password' WHERE Lname = '$iFName' AND Mname ='$iMName' AND  Lname = '$iLName'  ",$open_con);

                if(!$i_sqlupdate)
                    {
                    die("Error in saving: ". mysql_error());
                    }
            }

            else
            {
                $i_sqlinsert= mysql_query("INSERT INTO tblteacher_info (Teacher_ID, Fname, Mname, Lname, Username, Password) VALUES ('0', '$iFName', '$iMName', '$iLName', '$username', '$password')",$open_con);

                if(!$i_sqlinsert)
                    {
                    die("Error in saving: ". mysql_error());
                    }

            } 

}
?>
Bachu 45 Newbie Poster

Exg:

<?php
$txtName=$_POST['txtName'];
$txtEmail=$_POST['txtEmail'];
$fileName=$_POST['fileName'];
$txtIndustry=$_POST['txtIndustry'];
$txtCountry=$_POST['txtCountry'];
$txtCompensation=$_POST['txtCompensation'];
$currentPage=$_POST['currentpage'];
$host=$_SERVER['HTTP_HOST'];
$download='<tr><td colspan="2">Downloads: <a href="http://'.$host.'/filepath/'.$fileName.'"  target="_blank" >'.$fileName.'</a></td></tr>';


$enquiry='<table width=700 border=0 cellspacing=2 cellpadding=2 align=center>
<tr><td align=right width=100>Name: </td><td>'.$txtName.'</td></tr>
<tr><td align=right width=100>Email: </td><td>'.$txtEmail.'</td></tr>
<tr><td align=right width=100>Industry: </td><td>'.$txtIndustry.'</td></tr>
<tr><td align=right width=200>Preferred Country: </td><td>'.$txtCountry.'</td></tr>
<tr><td align=right width=200>Expected Compensation: </td><td>'.$txtCompensation.'</td></tr>
'.$download.'
</table>';

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

$headers .= "From:info@your.com\r\n";

$user="info@your.com";

mail($user,"Your Web Info", $enquiry, $headers);

?>
Bachu 45 Newbie Poster

A Simple methode is

upload your file to your server location and take that uploaded file path.
Attach this filepath to your mail content for download this file.

Bachu 45 Newbie Poster
if($_POST['add_marks'] ==1)
{
include('includes/connect.php');
$bots = array();
$mts = array();
$eots = array();

$bots =$_POST['bot'];
$mts=$_POST['mt'];
$eots=$_POST['eot'];

    foreach($bots as $key=>$bot)
    {
    $insert = "INSERT INTO marks(beginning_of_term,mid_term,end_of_term) VALUES('$bot','$mts[$key]','$eots[$key]')";
    $execute_insert = mysql_query($insert);
    }
}
Bachu 45 Newbie Poster
<?php
$sql=mysql_query("SELECT * FROM `products` where tf=1 and star='7' ORDER BY `id` DESC");
$inc = 0;
while($r=mysql_fetch_array($sql)){
    $inc++;
    $id=$r['id'];
    ?>
<div style="width:152px; height:205px;">

<?php echo $id; ?>
</div>
<?php 
    if($inc%4==0) echo '<hr />';
} 
?>

Here I have seperated each 4 items by hr tag.. This will help you... to know how to
seperte items.

mahdiyazdani commented: Thanks +0
Bachu 45 Newbie Poster

In form

<tr bgcolor="<?php echo $bg; ?>">
                  <td><?php  echo $rows['firstName']." ".$rows['lastName']." ".$rows['otherName'];  ?></td>
                  <td><?php  echo $rows['regNo']; ?></td>
                  <td><?php  echo $rows['class']." ".$rows['stream']; ?></td>
                    <td><div align="center"><input type="text" name="bot[]" size="10" /></div></td>
                  <td><div align="center"><input type="text" name="mt[]" size="10" /></div></td>
                  <td><div align="center"><input type="text" name="eot[]" size="10" />
                  <input type="hidden" value="<?php echo $rows['school_id']; ?>" name="schoolId[]"> 
                  </div></td>
              </tr>

In action page

if($_POST['add_marks'] ==1)
{
include('includes/connect.php');
$bots =$_POST['bot'];
$mts=$_POST['mt'];
$eots=$_POST['eot'];
    foreach($bots as $key=>$bot)
    {
    $insert = "INSERT INTO marks(beginning_of_term,mid_term,end_of_term) VALUES('$bot','$mts[$key]','$eots[$key]')";
    $execute_insert = mysql_query($insert);
    }
}
broj1 commented: Nice and concise +6
Bachu 45 Newbie Poster

In form.php

<html>
<body>

<form action="number.php" method="post">

Enter number: <input type="text" name="number" /><br /><br />

Enter number to Add: <input type="text" name="add" /><br /><br />

Enter number to Subtract: <input type="text" name="subtract" /><br /><br />

Enter number to multiply: <input type="text" name="multiply" /><br /><br />

Enter number to divide: <input type="text" name="divide" /><br /><br />

<input type="submit" value="Submit">

</form>

</body>
</html>

In number.php

<?php
$number = (isset($_POST['number']) && $_POST['number']!="") ? $_POST['number'] : '0';
print "\$number = ".$number.";<br />";
$number += $_POST['add'];
print "\$number += ".$_POST['add'].";<br /> The answer is <b>$number</b>. <br /><br />";

$number -= $_POST['subtract'];
print "\$number -= ".$_POST['subtract'].";<br /> The answer is <b>$number</b>. <br /><br />";

$number *= $_POST['multiply'];
print "\$number *= ".$_POST['multiply'].";<br /> The answer is <b>$number</b>. <br /><br />";

$number/= $_POST['divide'];
print "\$number /= ".$_POST['divide'].";<br /> The answer is <b>$number</b>. <br /><br />";

?>
LastMitch commented: Thanks for the example! +5
Bachu 45 Newbie Poster
Bachu 45 Newbie Poster

date ('d/m/y \a\t H:i');

OR

date ('d/m/y').' at '.date('H:i');

Bachu 45 Newbie Poster
<?php

$images = array('T1.jpg','I2.jpg','M3.jpg','E4.jpg');

$alt = array('Time','To','Tell','Toke');

foreach($images as $key=>$image) {
    echo '<img src="images/'.$image.'" alt="'.$alt[$key].'" />';
}

?>
Bachu 45 Newbie Poster
Bachu 45 Newbie Poster

You need to install CURL. Check this link

http://www.php.net/manual/en/curl.setup.php