Jump to content

Cant find where the error in my coding is


OriginalSunny

Recommended Posts

Hi i am having a problem trying to sort out the my date of birth section in the form i want the user to
fill out. I have used the following code to do my credit card valuation:

[i] elseif($field == [b]"cc_exp"[/b])
{
echo "<tr><td style=\"text-align: right;
font-weight: bold\">Expiration Date</td>
<td><select name=[b]'cc_exp_mo'[/b]>";
for($n=1;$n<=12;$n++)
{
echo " <option value='$n'>$n\n";
}
echo "</select>\n";
echo "<select name=[b]'cc_exp_da'[/b]>";
for($n=1;$n<=31;$n++)
{
echo " <option value='$n'>$n\n";
}
echo "</select>\n";
echo "<select name=[b]'cc_exp_yr'[/b]>";
$start_yr = date("Y",$today);
[b] for($n=$start_yr;$n<=$start_yr+5;$n++)[/b]
{
echo " <option value='$n'>$n\n";
}
echo "</select>\n";
}[/i]

This works fine. However to do date of birth u need to change the code above which is in bold. The first problem is that if "cc_exp" on the first line and "cc_exp_mo", "cc_exp_da" and "cc_exp_yr" to "DOB", "dob_mo", dob_da", dob_yr" it comes up with the error 'no such field cc_exp_mo'.

The next problem is when i change ($n=$start_yr;$n<=$start_yr+5;$n++) to either of the following it doesnt work:

for($n=$start_yr;$n<=$start_yr-50;$n--)
for($n=$start_yr;$n<=$start_yr-50;$n++)
for($n=$start_yr;$n<=$start_yr+50;$n--)

It currently shows the dates between 2006 and 2011. I need it to show the dates between 2006 and 50 yrs before 2006.
So what should i be doing here??
Thanks.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.