(新文件不会覆盖现有文件,看看 Jess StackOverflow 如何替换旧的 John Snow)
This is my
The issue is that I want to modify the information after that. How can I get the element by tag name so that I can modify the information about the specific student?
Consider a dynamic XSLT (the transformation language used to modify
You need <form> tags to initiate the $_POST array and send values to server-side. Add needed action below.
You need to give each <input> a distinct name which you already have with $getElementTag. Consider sanitizing the server side $_POST values.
You need a hidden input field to retain the old firstname in case the user changes this value. This field is important as it is used in XSLT to select the appropriate <student> node to update.
PHP Script
Below script contains only the two if (isset(...) conditionals. Integrate into your full script and be sure echoes do not appear above <html> and <head>. Also, the embedded XSLT string is included. Be sure to have the XSLTProcessor extension (php_xsl.dll or php_xsl.so) enabled in .ini file.
<?php
$
HTML Input
Output
(new file does not overwrite existing, see how the Jess StackOverflow replaces the old John Snow)