PHP code for forms: - tutorials, articles, etc.

  ade.h 19:05 26 Mar 2006

I've been reading the W3 Schools tutorial on PHP, particularly the section about forms, but it's not really detailed enough. (Never thought I'd say that about a coding article!)

Can anyone suggest a more detailed explanation of PHP coding for forms and form handlers? It seems simpler than I expected, so I'd be happy to have go at editing it myself.

I have had no luck with the form handler in NOF, which I have been trying to use without success on two different PHP-enabled servers. When I used it for the first time, it successfully outputted the fields and data to an email, generated on the server, which I received in my inbox okay. I didn't bother using it at that time, but recently decided to incorporate it into a site and the form handler just outputted the fields and data to an outgoing message window!

When I can get a test page onto some webspace, I'll post a link here.

  beynac 10:17 27 Mar 2006

Example: you have an HTML form where <form method="POST" action="franceresult.php"> and <input name="FmDeptNo" ...> The user enters, say, "61" into the form and hits "Submit".

This will open a page "franceresult.php". On that page, you will have set a variable within the php code tags (e.g.): "$DeptNo = $_POST["FmDeptNo"];". This should be the first item on the page. In the example, $DeptNo will now hold the value "61". You then use the variable to perform the required action (e.g. query a MySQL database etc.).

  beynac 11:47 27 Mar 2006

Have you seen the PHP Manual? click here

  ade.h 15:54 27 Mar 2006

No, but I will. Thanks for the link. So far (early days) I have just been using the info from W3 Schools, but it hasn't covered email forms in more than passing detail.

Thanks for the response.

  beynac 08:33 28 Mar 2006

Hi ade.h

I'm glad the link was helpful. You can also get the PHP Manual as a compiled help file from click here (get the chm or file). I have linked this to a toolbar button in HomeSite (my html editor). I also recommend Larry Ullman's book, "PHP for the World Wide Web" (Visual Quickstart Guide).

If you are using php with forms, have a look at Matt45's good advice and code here: click here

  ade.h 16:04 28 Mar 2006

Wow! That one is going in my bookmarks ASAP. Very useful, especially as the spam issue is one of the reasons for wanting to use a form in the first place. Thanks very much for that, Beynac, and to Matt45 if he's reading this.

As soon I get my freespace cleared (got another project there at the mo) I will post a form created in NOF without any editing to see it still fails to work, and I will post the link here for others to check. I'll leave this unticked for now and do some more reading!

  Maturin 13:25 29 Mar 2006


This thread is now locked and can not be replied to.

Elsewhere on IDG sites

Honor 9 Lite review

HomePod review

Les meilleurs logiciels de montage vidéo gratuits (2018)