Form handling

putting data back into an html form for editing

Page 1 of 1

6 Replies - 2200 Views - Last Post: 18 August 2006 - 09:20 AM Rate Topic: -----

#1 matt-the-mash   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 122
  • Joined: 10-July 06

Form handling

Posted 18 August 2006 - 03:08 AM

Hi,

I have a booking system which uses an html form to gather customer info. It then enters this info into a database and then viewed on another screen.

If i want to edit the information, i currently search for a name, then this outputs the data from the database onto the screen for viewing. How do i put this information back into the html form so that i dont have to re-write everything back in?
Is This A Good Question/Topic? 0
  • +

Replies To: Form handling

#2 Amadeus   User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 253
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Form handling

Posted 18 August 2006 - 05:26 AM

Hmm...without seeing your code, it's a little tough, but you can have a form for editing simply by taking the form you have for entry, and in the value fields for each element of the form, write the values from the database. Instead of echoing them onto the screen for viewing, echo them into the value fields for editing.
Was This Post Helpful? 0
  • +
  • -

#3 matt-the-mash   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 122
  • Joined: 10-July 06

Re: Form handling

Posted 18 August 2006 - 06:20 AM

Would you embed the field data within the html, or out put the form buy echo'ing the table out?

If so, im not sure of the syntax for embedding.

I presume that if the field data is echoed into the form in php, i wont be able to edit it. Is this right?
Was This Post Helpful? 0
  • +
  • -

#4 Amadeus   User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 253
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Form handling

Posted 18 August 2006 - 06:25 AM

<input type="text" name="field1" id="field1" value="<?=$myvarfromdatabase?>"/>


You can edit it.
Was This Post Helpful? 0
  • +
  • -

#5 matt-the-mash   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 122
  • Joined: 10-July 06

Re: Form handling

Posted 18 August 2006 - 08:12 AM

Thanks Amadeus,

That works a treat.

Thats the hardest thing about learning a programme language, the syntax. The logic is easy!!


Do you know any good resources for learning how to format a date input from a form to a mysql database?

Seems to me the biggest (and possily the last!) hurdle i need to overcome to have my web application easy and usable.
Was This Post Helpful? 0
  • +
  • -

#6 Amadeus   User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 253
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Form handling

Posted 18 August 2006 - 08:39 AM

Assuming you're referring to the deafult format MySQL expects for a date, something like the following should work:
$now = time();
$now = date('YmdHis',$now)


but there are many other ways to do it as well.
Was This Post Helpful? 0
  • +
  • -

#7 matt-the-mash   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 122
  • Joined: 10-July 06

Re: Form handling

Posted 18 August 2006 - 09:20 AM

Thanks for the tip. Im off on holiday now so i'll have a play with that when i get back.
:D
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1