473,545 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP XML XSL HTML Form

Hello all,

I am working on a generic (php) script to produce (X)HTML Forms through XML
and XSL based on field-definitions stored in a database.

The basic way i did HTML-forms in PHP was like this:
http://212.204.203.71/test/simpleform/simpleform.php

source: http://212.204.203.71/test/syntax/simpleform.php

This basic form is validated when it is submitted to itself... if validation
fails then an error message is created and displayed on the page...otherwis e
validation is ok and we can do some inserting in the database and/or
redirect to another page. Remark: the fields that are filled will be
automaically filled in if the page is submitted to itself (that will be my
problem in the XML/XSL version of this script).

Now we go over to the XML/XSL version of the script above: I therefore
created an XML file (holding the field definitions) see:
http://212.204.203.71/test/xmlform/form.xml

And further i created an XSL file to transform the XML file into a HTML
form. see: http://212.204.203.71/test/xmlform/form.xsl

Then i used a file form.php to put the XML and XSL together using some PHP
xslt functions: http://212.204.203.71/test/xmlform/form.php

source: http://212.204.203.71/test/syntax/form.php

This all works fine but now the problem. I am looking for a concept of how
to get the formfields filled in again after submitting the form because in
XSL this is not as easy as with my basic form. I tried to send firstname and
lastname as parameters in the function call and to put them as parameters in
the xsl file but that does not work and it is not ok at all because my
intention was to build a generic script....

Hope you see my problem as it is hard to explain.

Regards,

Jochem (jo***********@ REMOVETHISANTIS PAMquicknet.nl)

Jul 17 '05 #1
5 2849
Take a look at my sample application which is PHP+MySQL+XML+X SL and which
does what you describe. Run it online, or download the source code to see
how it works.

HTH.

--
Tony Marston

http://www.tonymarston.net

"Marcel" <so************ ***@nospam.com> wrote in message
news:4c******** *************** ****@news.multi kabel.nl...
Hello all,

I am working on a generic (php) script to produce (X)HTML Forms through
XML
and XSL based on field-definitions stored in a database.

The basic way i did HTML-forms in PHP was like this:
http://212.204.203.71/test/simpleform/simpleform.php

source: http://212.204.203.71/test/syntax/simpleform.php

This basic form is validated when it is submitted to itself... if
validation
fails then an error message is created and displayed on the
page...otherwis e
validation is ok and we can do some inserting in the database and/or
redirect to another page. Remark: the fields that are filled will be
automaically filled in if the page is submitted to itself (that will be my
problem in the XML/XSL version of this script).

Now we go over to the XML/XSL version of the script above: I therefore
created an XML file (holding the field definitions) see:
http://212.204.203.71/test/xmlform/form.xml

And further i created an XSL file to transform the XML file into a HTML
form. see: http://212.204.203.71/test/xmlform/form.xsl

Then i used a file form.php to put the XML and XSL together using some PHP
xslt functions: http://212.204.203.71/test/xmlform/form.php

source: http://212.204.203.71/test/syntax/form.php

This all works fine but now the problem. I am looking for a concept of how
to get the formfields filled in again after submitting the form because in
XSL this is not as easy as with my basic form. I tried to send firstname
and
lastname as parameters in the function call and to put them as parameters
in
the xsl file but that does not work and it is not ok at all because my
intention was to build a generic script....

Hope you see my problem as it is hard to explain.

Regards,

Jochem (jo***********@ REMOVETHISANTIS PAMquicknet.nl)

Jul 17 '05 #2
Marcel wrote:

This all works fine but now the problem. I am looking for a concept of how
to get the formfields filled in again after submitting the form


At the top of the form try something like this:

$clean = array();
foreach ($_POST as $name=>$value) {
$clean[$name] = YourSanitizeFun ction($value);
}

If javascript is acceptable to you , just toss this at the bottom (usual
disclaimers about top-of-my-head, no error checking blah blah):

echo "<script>\n ";
foreach ($clean as $name=$value) {
echo "document.getEl ementsByName($n ame)[0].value='$value' \n";
}
echo "</script>\n";

This will work in IE, Mozilla, and Opera. In production you would on
general principles replace the verbose "document.getEl ements..." construct
with a function call to some function that does the same thing.

Now, if Javascript is not acceptable, then somebody more knowledgeable than
I will have to tell you how to do the transform. I won't touch for
something like this because it seems like a lot of extra steps. I mean, if
you have to generate the transformation out of a dictionary, why not
generate the HTML and save some steps and retain more control? It's so
much easier to do this:

foreach ($dictionary_co ls as $colname=>$coli nfo) {
$name = logic goes here...
$value = $colinfo["value"];
$disabled = logic goes here...
echo "<input name=\"$name\" id=\"$name\" $disabled $value=\"$value \">....
}

--
Kenneth Downs
Secure Data Software, Inc.
(Ken)nneth@(Sec )ure(Dat)a(.com )
Jul 17 '05 #3

"Tony Marston" <to**@NOSPAM.de mon.co.uk> schreef in bericht
news:d0******** ***********@new s.demon.co.uk.. .
Take a look at my sample application which is PHP+MySQL+XML+X SL and which
does what you describe. Run it online, or download the source code to see
how it works.

HTH.

--


Hi Tony,

Thanks for your answer! I am impressed by the number of examples on your
site. Can you please tell me which example i should use e.g which example
covers my posting?

Thanks and regards,

Marcel
Jul 17 '05 #4
Try any of the input forms as these reshow any user-entered data as well as
any error messages.

--
Tony Marston

http://www.tonymarston.net

"Barbara" <ge******@quick net.nl> wrote in message
news:72******** *************** ***@news.multik abel.nl...

"Tony Marston" <to**@NOSPAM.de mon.co.uk> schreef in bericht
news:d0******** ***********@new s.demon.co.uk.. .
Take a look at my sample application which is PHP+MySQL+XML+X SL and which
does what you describe. Run it online, or download the source code to see
how it works.

HTH.

--


Hi Tony,

Thanks for your answer! I am impressed by the number of examples on your
site. Can you please tell me which example i should use e.g which example
covers my posting?

Thanks and regards,

Marcel

Jul 17 '05 #5
Ok i will, thanks a lot Tony!!!
"Tony Marston" <to**@NOSPAM.de mon.co.uk> schreef in bericht
news:d0******** ***********@new s.demon.co.uk.. .
Try any of the input forms as these reshow any user-entered data as well
as any error messages.

--
Tony Marston

http://www.tonymarston.net

"Barbara" <ge******@quick net.nl> wrote in message
news:72******** *************** ***@news.multik abel.nl...

"Tony Marston" <to**@NOSPAM.de mon.co.uk> schreef in bericht
news:d0******** ***********@new s.demon.co.uk.. .
Take a look at my sample application which is PHP+MySQL+XML+X SL and
which
does what you describe. Run it online, or download the source code to
see
how it works.

HTH.

--


Hi Tony,

Thanks for your answer! I am impressed by the number of examples on your
site. Can you please tell me which example i should use e.g which example
covers my posting?

Thanks and regards,

Marcel


Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2147
by: Hansan | last post by:
Hi all, I hope you have time to help me out a little. My problem is that I want to combine some python code I have made with some html templates, I found a tutorial at dev shed: http://devshed.spunge.org/Server_Side/Python/CGI/page6.html and : http://devshed.spunge.org/Server_Side/Python/CGI/page5.html and tried to do it like they do, but it...
5
6075
by: Richard Cornford | last post by:
I am interested in hearing opinions on the semantic meaning of FORM (elements) in HTML. I have to start of apologising because this question arose in a context that is not applicable to the Internet. Specifically, marking up a document that will contain multiple related form controls (intended exclusively for client-side scripting) that...
16
2867
by: Philippe C. Martin | last post by:
Hi, I am trying to change the data in a form field from python. The following code does not crash but has no effect as if "form" is just a copy of the original html form. Must I recreate the form order to do that ? My point is for the client to be able to re-read the modified data.
17
2457
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control 'Button19' of type 'Button' must be placed inside a form tag with runat=server Can the IDE not do what it is supposed to do. It seems that it is a...
4
1986
by: Sathyaish | last post by:
I am no JavaScript progammer, and unfortunately am having to babysit an old code base that has a lot of JavaScript in it. I have two questions: (1) Can two HTML controls have the same name? It looks like the obvious answer is NO. (2) What if? What if the developer has given two HTML controls the same name, i.e has created the same...
7
2781
by: thersitz | last post by:
I can't seem to get my html form to submit properly from within a web form. Here's my form tag syntax and some delivery hidden fields. <form id="myForm" action="https://xxx.order.net/xxx/cgi-bin/delivery.cgi" method="POST" onsubmit="return verify();"> <input type="hidden" name="recipient" value=me@mymail.net /> <input type="hidden"...
19
248042
Atli
by: Atli | last post by:
Introduction At some point, all web developers will need to collect data from their users. In a dynamic web page, everything revolves around the users input, so knowing how to ask for and collect this data is essential to any developer. This article is a basic tutorial on how to user HTML Forms, the most common method of data collection. ...
1
2759
by: Arpit Nagar | last post by:
Hi... I am creating a dummy project for collage. Here I had choosen my project as Jewelleryshoping. Now the scenerio is like that thier are jewellry item which I had display in table format with images using form tag for button. Now the case is like I dont want to use any database like sql,serversite,php etc. I just want to use html or...
10
6934
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration of section c. Not sure where went wrong as the web page displayed internal server error. Also, what is the error 543? and error 2114....
9
2498
by: dhtml | last post by:
I have written an article "Unsafe Names for HTML Form Controls". <URL: http://jibbering.com/faq/names/ > I would appreciate any reviews, technical or otherwise. Garrett -- comp.lang.javascript FAQ <URL: http://jibbering.com/faq/ >
0
7656
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7807
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7419
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7756
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4944
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3450
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1879
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
703
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.