pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris <csmith@squiz.net>
To: Paul Joseph McGee <mcgee@student.cs.ucc.ie>
To: pgsql-php@postgresql.org
Subject: Re: Input Forms
Date: Mon, 26 Mar 2001 10:28:31 +1000
Message-ID: <4.3.2.7.2.20010326102351.00bb1b70@203.25.173.1> (raw)
In-Reply-To: <Pine.OSF.3.96.1010325164246.24677A-100000@student.cs.ucc.i e>


>Hi
>
>I have a table in my database which has a column of type date. When I
>retrieve the date from the database, I brake it up into seperate
>variables, as in $day, $month, $year. My problem is that I give the user
>the chance to change the date that is in the database so I have 3
>input/text fields that the user change select the day, month and year. BUT
>I want the selected day, month, year to be the one that is in the database
>so the user will then decide if that date is alright.
>I don't know how to do this, would it be javasript, and if so would it be
>something like onload???

You can do it with PHP.. as you're going through the select list, do a check -

     # For the days list box....
for ($days = 1; $days < 32; $days++) {
     echo "<option value=".$days;
     if ($days == $your_days) {
         echo " SELECTED";
     }
     echo ">".$days."\n";
}

this is the way i usually do it, works pretty well.. :) Of course, it can 
be written differently, but that's up to you..

HTH

------------------------
Chris Smith
http://www.squiz.net




view thread (2+ messages)

Message-ID: <4.3.2.7.2.20010326102351.00bb1b70@203.25.173.1>
Permalink:  ../4.3.2.7.2.20010326102351.00bb1b70@203.25.173.1/
Also on:    postgresql.org/message-id/4.3.2.7.2.20010326102351.00bb1b70@203.25.173.1

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: csmith@squiz.net, mcgee@student.cs.ucc.ie
  Subject: Re: Input Forms
  In-Reply-To: <4.3.2.7.2.20010326102351.00bb1b70@203.25.173.1>
  References: <4.3.2.7.2.20010326102351.00bb1b70@203.25.173.1>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox