Bachu 45 Newbie Poster

Hai;

This link will help you

http://stackoverflow.com/questions/5418262/how-to-enable-curl-in-xampp

You need to edit two flies... check the above link

Bachu 45 Newbie Poster

Hai;

You can do this. Get the date from the date field and set the select query like "SELECT * FROM db_usertable WHERE DATE(LastLoginedField) = '$yourDate';"

Bachu 45 Newbie Poster

Hai;

Try this

<form name="dateForm" id="dateForm" method="post" action="#">
<label for="txtStartingDate">Starting Date</label>
<input type="text" name="txtStartingDate" id="txtStartingDate" value="<?php  echo (isset($_POST['txtStartingDate'])) ? $_POST['txtStartingDate'] : ""; ?>" />
<label for="txtEndDate">End Date</label>
<input type="text" name="txtEndDate" id="txtEndDate" value="<?php  echo (isset($_POST['txtEndDate'])) ? $_POST['txtEndDate'] : ""; ?>"  />
<input type="submit" name="sbtbtn" value="Submit" /> 
</form>

<?php
if(isset($_POST['sbtbtn'])){
$diff = abs(strtotime($_POST['txtStartingDate']) - strtotime($_POST['txtEndDate']));
$days = floor(($diff)/ (60*60*24));
?>
<label for="txtResult">Result</label>
<input type="text" name="txtResult" id="txtResult" value="<?php echo $days; ?>"  />
<?php

}
?>
Bachu 45 Newbie Poster

Hai;

check this link Click Here

Bachu 45 Newbie Poster

Hai;

Try this,

** in main page **

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<table>
 <tr>
      <th><p>Amount</p></th>
      <td><?php echo $row[6]=10;?></td>
    </tr>

    <tr >
      <th><p>Status</p></th>
      <td><p>



      <div id="poll"> 
  <p><input type="radio" name="col" value="Collected" class="pole_type">
  Collected</p>
        <p><input type="radio" name="col" id="radio2" value="Postponed" class="pole_type" checked="checked"/>
          Postponed</p>
        <p><input type="radio" name="col" id="radio3" value="Rejected" class="pole_type" />
        Rejected</p>
     </div>  </p></td>

    </tr>
</table>
<script type="text/javascript">
$(function() {
    $(".pole_type").click(function(){
        var val = $(this).val();
        var orderId = "<?php echo $yourOrderId = 1; ?>";
         $.ajax({
            url: "ajaxrequest.php",
            type: "POST",
            data: "poll="+val+"&orderId="+orderId+"&action=editpoll",
            success: function (data) {
                alert(data);
            }
        }); 
    });
});
</script>

In ajaxrequest.php

<?php
switch($_POST['action']) {
    case'editpoll':
        //here you can do your action
        echo "Update your db with OrderId:".$_POST['orderId']." and poll status:".$_POST['poll'];
    break;
}
?>
Bachu 45 Newbie Poster

Hai;

This link will help you , plz check Click Here

Bachu 45 Newbie Poster

Hai;

use window.location.reload();

Bachu 45 Newbie Poster

Hai;

Try this..

<input type="text" name="txtfield" id="txtfield" value="" />
<input type="button" onclick="getValue()"  value="Get Value"/>

<script type="text/javascript">
function getValue() {
    alert(document.getElementById("txtfield").value);
}
</script>
Bachu 45 Newbie Poster

Hai;

This code also works

<body>
<style type="text/css">
table, th, td{
    margin: 0;
    font: 16px helvetica, sans-serif;
    border: 1px solid black;
}
tr {
    display: block;
}
</style>
    <form name="teacher" method="post" action="teacher.php">
        <table>
            <tr id="name">
                <td>
                    <label for="first_name">First Name</label>
                </td>
                <td>
                    <input type="text" name="first_name">
                </td>
                <td>
                    <label for="last_name">Last Name</label>
                </td>
                <td>
                    <input type="text" name="last_name">
                </td>
            </tr>
            <tr>
                <td>
                    <label for="course1">Course 1</label>
                </td>
                <td>
                    <input type="text" name="course1">
                </td>
                <td>
                    <label for="course2">Course 2</label>
                </td>
                <td>
                    <input type="text" name="course2">
                </td>
            </tr>
            <tr id="courses1" style="display:none;" >
                <td>
                    <label for="course3">Course 3</label>
                </td>
                <td>
                    <input type="text" name="course2">
                </td>
                <td>
                    <label for="course4">Course 4</label>
                </td>
                <td>
                    <input type="text" name="course4">
                </td>
            </tr>
            <tr id="courses2" style="display:none;" >
                <td>
                    <label for="course5">Course 5</label>
                </td>
                <td>
                    <input type="text" name="course5">
                </td>
                <td>
                    <label for="course6">Course 6</label>
                </td>
                <td>
                    <input type="text" name="course6">
                </td>
            </tr>
            <tr id="courses3" style="display:none;">
                <td>
                    <label for="course7">Course 7</label>
                </td>
                <td>
                    <input type="text" name="course7">
                </td>
                <td>
                    <label for="course8">Course 8</label>
                </td>
                <td>
                    <input type="text" name="course8">
                </td>
            </tr>
            <tr id="courses4" style="display:none;">
                <td>
                    <label for="course9">Course 9</label>
                </td>
                <td>
                    <input type="text" name="course9">
                </td>
                <td>
                    <label for="course10">Course 10</label>
                </td>
                <td>
                    <input type="text" name="course10">
                </td>
            </tr>
            <tr id="courses5" style="display:none;">
                <td>
                    <label for="course11">Course 11</label>
                </td>
                <td>
                    <input type="text" name="course11">
                </td>
                <td>
                    <label for="course12">Course 12</label>
                </td>
                <td>
                    <input type="text" name="course12">
                </td>
            </tr>
            <tr id="courses6" style="display:none;">
                <td>
                    <label for="course13">Course 13</label>
                </td>
                <td>
                    <input type="text" name="course13">
                </td>
                <td>
                    <label for="course14">Course 14</label>
                </td>
                <td>
                    <input type="text" name="course14">
                </td>
            </tr>
            <tr id="courses7" style="display:none;">
                <td>
                    <label for="course15">Course 15</label>
                </td>
                <td>
                    <input type="text" name="course15">
                </td>
                <td>
                    <label for="course16">Course 16</label>
                </td>
                <td>
                    <input type="text" name="course16">
                </td>
            </tr>
            <tr> …
Bachu 45 Newbie Poster

Hai;

Chek the given example

<?php
$fetch_row = array("1","2","3","4","5","6","7","7.2","9","10","10.3");
foreach  ($fetch_row as $key=>$myRow) {
    if($key>0){
        $difference = $myRow-$previousValue;
        echo "different between ".$myRow." and ".$previousValue." = ".$difference."<br />";
        if($difference< 0.5) echo "Your difference is < 0.5.";
        echo "<hr />";

    }
    $previousValue = $myRow;
}

?>
Bachu 45 Newbie Poster

Hai;
@sruthisru
Check this link
Click Here

Bachu 45 Newbie Poster

Hai;

I think the below example will help you

<?php
if(isset($_FILES["txtFile"])) {
$allowedExts = array("doc", "docx", "txt", "pdf");
$extension = end(explode(".", $_FILES["txtFile"]["name"]));
$message = "";
if ((($_FILES["txtFile"]["type"] == "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
|| ($_FILES["txtFile"]["type"] == "application/pdf")
|| ($_FILES["txtFile"]["type"] == "application/msword")
|| ($_FILES["txtFile"]["type"] == "text/plain"))
&& ($_FILES["txtFile"]["size"] < 2000000)
&& in_array($extension, $allowedExts))
  {
  if ($_FILES["txtFile"]["error"] > 0)
    {
    $message.= "Return Code: " . $_FILES["file"]["error"] . "<br>";
    }
  else
    {   
    $tempFile = $_FILES['txtFile']['tmp_name'];
    $targetPath = 'admin/images/uploads/CV/';
    $newFileName =$_FILES['txtFile']['name'];
    $targetFile =  str_replace('//','/', $targetPath) . $newFileName;

    $cpy=1;
    do {


        $targetFile =  str_replace('//','/',$targetPath) ."Copy".$cpy. $_FILES['txtFile']['name'];
            $fileName="Copy".$cpy. $_FILES['txtFile']['name'];
            $cpy++;
        }while(is_file($targetFile));

        move_uploaded_file($tempFile,$targetFile);

        //here you can call your database and set up your insert query..
        //in this example I use an oop's for insert data
        $myObject->insertDataFunction(addslashes($_REQUEST['txtname']),addslashes($_REQUEST['txtemail']),($_REQUEST['txtPhone']),addslashes($_REQUEST['txaComments']),$fileName,$_REQUEST['id']);
        }
        ?>
Bachu 45 Newbie Poster

Try the following example:

In index.php

 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
$(function() {
    $.ajax({
    dataType: "json",
    url: "json.php",
    success: function (data) {
        for (var index = 0; index < data.length; index++) {
            alert(data[index]);
        }
    }
    });

});
</script>

In json.php

<?php
$array = array("0","1","2","3","4","5","6","7","8");
echo json_encode($array);
?>
Bachu 45 Newbie Poster

Hai;

Make sure that your actual database name is my_db

Bachu 45 Newbie Poster
Bachu 45 Newbie Poster

Hai;

Chek this link http://code.google.com/p/php-excel/source/browse/branches/class-excel-xml.inc.php?r=9

Use class Excel_XML and include this class in your donmload link page.

Example for download ling page:

<?php
include_once("model/excel.php");//includeind class Excel_XML

//get data from database
include_once("model/user.php");
$user   =   new User();
$getAllUsres  = $user->getOtherUsers();

//set the data base result in to a variable         
            $table='<table id="ReportTable" width="900" cellpadding="2" cellspacing="2" class="myClass" border="1">
    <tr><th>Frist Name</th><th>Last Name</th><th>Email</th><th>City</th><th>Address</th></tr>';

      foreach($getAllUsres  as $myReg) {
            $table.='<tr><td><center>'.$myReg->FirstName.'</center></td><td><center>'.$myReg->LastName.'</center></td><td><center>'.$myReg->Email.'</center></td><td><center>'.$myReg->City.'</center></td><td><center>'.nl2br($myReg->AddressOne).'</center></td></tr>';   
      }

      $table.='</table>';
      header('Content-Type: application/force-download');
header('Content-disposition: attachment; filename=quiwed-users.xls');

header("Pragma: public");
header("Cache-Control: ");
echo $table;

?>
Bachu 45 Newbie Poster

You can't directly asign php varible values from javascript.
Php is server side script.
If you want this value for your form , use hidden input type and asign that value to this hiden input type.

Bachu 45 Newbie Poster

You can use imagefttext . Check this link

http://php.net/manual/en/function.imagefttext.php

Bachu 45 Newbie Poster

Try this

<!DOCTYPE HTML>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>

</head>
<body>
<?php
session_start();
if(isset($_SESSION['pageload'])) {
    $_SESSION['pageload']=$_SESSION['pageload'] + 1;
}
else {
    $_SESSION['pageload']=1;
}


?>
<div class="fieldClass">

</div>
<script type="text/javascript">
$(function(){
          var count ='<?php echo $_SESSION['pageload'];  ?>';
         for (var i = 1; i <=count; i++) {
             $('.fieldClass').append('<input type="text" name="itemquantity[]" value="'+i+'"/><br />');
         }
});
</script>

</body>
</html>

And Unset session $_SESSION['pageload'] if you go to another page

Bachu 45 Newbie Poster

Hai;

Now I pass value like
http://localhost/wordpress/user?username=bachov-1

And print the value like echo $_REQUEST['username'];

But my requirement is like http://localhost/wordpress/bachov-1. and get the value from $_REQUEST['username'].I think some htaccess setting is required.If anyone knows this solution , please help me ..

Bachu 45 Newbie Poster

Hai;

How can I rewrite user profile page url like http://website.com/firstnamesecondname-id in wordpress ?

Please help me.

Bachu 45 Newbie Poster
Bachu 45 Newbie Poster

Change This

$sql="SELECT idNumber, mType FROM tableItem";

To

$sql="SELECT idNumber, mType FROM tableItem  GROUP BY mType";
Bachu 45 Newbie Poster
Bachu 45 Newbie Poster

Try this

<!DOCTYPE HTML>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>

</head>
<body>
<table class="addRows">

</table>

<input type="button" name="addrow" value="Add Row" class="addRowBtn">
<script type="text/javascript">
$(function(){

           $('.addRowBtn').live('click',function() {
               $('.addRows').append('<tr><td><input type="text" name="txt1[]"></td><td><input type="text" name="txt2[]"></td><td><input type="text" name="txt3[]"></td><td><a href="#NOD" class="removeRow">Remove</a></td></tr>');
           })

           $('.removeRow').live('click', function() {
            $(this).closest('tr').remove();
           });
});
</script>

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

PHP is server Side script and Javascript client-side.So You can't do this.But you can use AJAX to call a PHP function from Javascript.

Bachu 45 Newbie Poster

Try this

<!DOCTYPE HTML>
        <html>
        <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>

        </head>
        <body>
        <table>
        <tr>
            <th>Cost</th>
            <th>Quantity</th>
            <th>Sub-Total</th>
        </tr>
        <tr class="txtMult">
        <td class="val1">1</td>
        <td><input class="val2" type="text" name="txt"/></td>
        <td><span class="sum">0</span></td>
        </tr>
        <tr class="txtMult">
        <td class="val1">2</td>
        <td><input class="val2" type="text" name="txt"/></td>
        <td><span class="sum">0</span></td>
        </tr>
        <tr>
        <td align="right" colspan="2"><strong>Total</strong></td>
        <td class="total">0</td>
        </tr>
        </table>


        <script type="text/javascript">
        $(function(){

            function getTotal() {
                var total=0;
                $(".sum").each(function() {
                    total = total + parseFloat($(this).html());
                });
                return  parseFloat(total);
            }

            $('.val2').live('keyup', function() {
                var cost = parseFloat($(this).closest('tr').find('.val1').html());
                var quantity = parseFloat($(this).closest('tr').find('.val2').val());
                if(quantity)    var quantity = quantity;
                else quantity =0;
                var sum = parseFloat(cost * quantity);
                $(this).closest('tr').find('.sum').html(sum);
                $('.total').html(getTotal);
            });

        });
        </script>

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

Try this

<!DOCTYPE HTML>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>

</head>
<body>
<form id="formElem">
<label for="txtName">Name</label>
<input type="text" name="txtName" />
<label for="txtAddress">Address</label>
<textarea name="txtAddress"></textarea>
</form>
<a href="#NOD" class="disableForm" >Disable Form</a>
<a href="#NOD" class="enableForm" >Enable Form</a>

<script type="text/javascript">
$(function(){
    $('.disableForm').click(function(){
        $('input, textarea').attr('disabled', true);
    });
    $('.enableForm').click(function(){
        $('input, textarea').attr('disabled', false);
    });
});
</script>

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

Try this

$expDateFormat = date("Y-m-d", $expDate);

Have any doubt ? Check this
http://php.net/manual/en/function.date.php

Bachu 45 Newbie Poster

Try this;

$menuList=array();
        $parentId = 0;
        $result = mysql_query("SELECT * FROM    db_Table  WHERE (parent_table = {$parentId}) ;");
        $mainMenus = mysql_fetch_array($result);
        foreach($mainMenus as $mm) {
            array_push($menuList, $mm);

            $result = mysql_query("SELECT * FROM     db_Table  WHERE  parent_table = {$mm->table_id};");
            $subMenu = mysql_fetch_array($result);

            if(sizeof($subMenu)>0) {
                array_push($menuList, $subMenu);
            }
        }
        print_r($menuList);

This is a basic code. inside it check, if any row with parent id equal to parnt id .. repeate this query

Bachu 45 Newbie Poster

You have a </htm> tag at the end which is at least not standard

Sorry ..Thats was my typing mistake..

Did you try like this ?

var optionalValues=[];
$j('#dibujoshechos option').each(function(){
    optionalValues.push( $j(this).attr('value'));
});
    var lospuntos="";
    var lospuntos = optionalValues[0]; 
    console.log("the value is " + lospuntos);

And check it in your console.

Bachu 45 Newbie Poster

When I try it in my PC it works fine.. One question . Why do you use $j ?
Check the following code. It's my 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 src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
</head>

<body>
<select id="My">
<option value="Test">0</option>
<option value="1">1</option>
<option value="2">2</option>
</select>
</body>
<script type="text/javascript">
$(function() {
var optionalValues=[];
$('#My option').each(function(){
    optionalValues.push( $(this).attr('value'));
});
    var FirstValue = optionalValues[0];
    alert(FirstValue);
});
</script>
</htm>
Bachu 45 Newbie Poster

It is possible, In jquery

exg:

<script type="text/javascript">
$(function(){
<?php
    if($id==1)
    {
?>
        window.location="page1.php";
<?php
    }
    else
    {
?>
        window.location="page2.php";
<?php    
    }
    ?>
});
</script>
Bachu 45 Newbie Poster

Try this

var optionalValues=[];
$('#combobox option').each(function(){
    optionalValues.push( $(this).attr('value'));
});
var FirstOption = optionalValues[0];
alert(FirstOption);
Bachu 45 Newbie Poster

By using Jquery , Try this

    $('#CompoBoxId').change(function() {
        alert($(this).val());
    });
Bachu 45 Newbie Poster

One methode, you can use jquery accordion like

http://jqueryui.com/accordion/

or

Check this link
http://www.1stwebdesigner.com/freebies/jquery-accordion-menus-tutorials/

Bachu 45 Newbie Poster

There are lot of issues

In container_24 you have given max-width: 980px;
but Mid_Content is a div inside of this div, For Mid_Content div you have given width: 1100px;

Why?

Give Mid_Content div width value with less than or equal to width of container_24 div

Bachu 45 Newbie Poster
Bachu 45 Newbie Poster

DIV in mysql returns Quotient of two numbers

Exg. If you want to get the Quotient of two fields of a database table
you can use

SELECT  (Field1 DIV Field2)  AS Result  FROM  your_table ;

This query will returns Quotient of Field1/Field2

Bachu 45 Newbie Poster

I think, one way is, give some delay for ajax success response, like

http://stackoverflow.com/questions/3497700/delay-load-of-data-for-2-seconds-in-jquery-ajax

Bachu 45 Newbie Poster
Bachu 45 Newbie Poster

When you check login of a user;
set Exp date from reg date like

$expDate = strtotime(date("Y-m-d", strtotime($regDate)) . " +30 days");

Set your select query like

SELECT * FROM UserTableName WHERE ($expDate >= DATE(NOW()))

If this query returns values .. set user is loged in

else redirect to login page

Bachu 45 Newbie Poster

Use javascript

First you hide the 3 radio buttons section. And display it in a click function
Refer this you will get the idea
http://girlswhogeek.com/tutorials/2007/show-and-hide-elements-with-javascript

Bachu 45 Newbie Poster

Use Float insted of align. Like

<div id="Mid_Content">

<div id="Left_Content">
<h2>heading </h2>
<p>
test</p>
</div>
<div id="Mid_point_Content">asdasd</div>
<div id="Right_Content">Form</div>
</div>


<style>
#Mid_Content {
    Width: 1000px;
    float: left;
}

#Left_Content {
width: 33%;
float:left;
}
#Mid_point_Content {
    Width: 33%;
    float: left;
}
#Right_Content {
    Width: 33%;
    float:left;
}

</style>
Bachu 45 Newbie Poster
broj1 commented: Very good link +7
diafol commented: Yep, good link x2 +14
Bachu 45 Newbie Poster

In your action page fetch all field names from database
&
in your while loop get tha posted values like $_POST['$row->yourFieldName']

Bachu 45 Newbie Poster
Bachu 45 Newbie Poster

Change your td css to

td {
    background-color: #EEEEEE;
    border-bottom: 1px solid #FFFFFF;
    border-left: 1px solid #FFFFFF;
    padding: 0 10px 0 0;
}
Bachu 45 Newbie Poster