0

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>
2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by Shanti C
0
<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..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.