Date issue.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wafasn
Forum Newbie
Posts: 6
Joined: Tue Apr 06, 2004 11:10 am

Date issue.

Post by wafasn »

Hi everyone,

I hope someone can help me with this:

I have a web page where user can search for an event by date(start_date). the page contains a textbox linked to a calnedar. When the user clicks on the calendar, this one popups, he select a date that goes to the textbox.
What I want to do is to prevent user from typing a date directley to the textbox. I used the property "disabled" for the textbox, it works fine but when I send data to another page"search.php" through the POST method, the variable "start_date" is empty.

here is the code:

<form name="dateForm" action="post" action="search.php">
<td width="62"><input type='text' name='start_date' disabled size='10'>
</td>
<td width="24"><a href="javascript:void(0)" onClick="showCalendar(dateForm.start_date,'yyyy/mm/dd','Choose date')">
<img src="../../images/calendar.gif" BORDER="0" width="23" height="23"></a>
</td>
<td width="31"><input name="go" type="submit" value="Go"></td>
</form>


Thanks in advance.
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

Put the date value to a hidden form field and just display it (rather than in a text field) ?
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

or if you want to display the date input area you should be able to use readonly instead of disabled.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Ya, I do this all the time in my applications, and you "readonly" is definitely what works.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply