can anyone help me out. why this code is not working?
i want that whatever date is in requst ship field add 10 days in that and show that in next filed cancle ship field.can anyone help me out.

<?
$a = uniqid();
$b=$a;

$d=date("m-d-y");

function data_copy()
{


$r_s_d =$_POST[r_s_d];

$date = strtotime(date("Y-m-d", strtotime($r_s_d)) . " +10 day");


}

?>
<html>
<boby>
<table>
<tr><td>order ID</td><td><input type="text" readonly="readonly" value="<? echo $b; ?>" /></td></tr>
<tr><td>customer identifier</td><td><input type="text" /></td></tr>
<tr><td>order date</td><td><input type="text" value="<? echo $d; ?>" /></td></tr>
<tr><td>requested ship date</td><td><input type="text" id="r_s_d" value="<? echo $d; ?>" onchange="<? data_copy() ?>" /></td></tr>
<tr><td>cancel date</td><td><input type="text" value="<? echo $date; ?>" /></td></tr>

</table
</body>
</html>
<tr><td>requested ship date</td><td><input type="text" id="r_s_d" value="<? echo $d; ?>" onchange="<? data_copy() ?>" /></td></tr>

You cannot call a php function on onchange of a form element.
change 28 line to:

<tr><td>requested ship date</td><td><input type="text" id="r_s_d" value="<? echo $d; ?>" onchange="data_copy()" /></td></tr>

and make data_copy() as javascript function..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.