2019-01-22 08:39
浏览 63


I have created a PHP page where there is a form which would store data on an XML file.

I have written the code of PHP which could store the data but now I have to redirect it to my homepage also. But the main error is when I write the Javascript code for redirecting the page, then the data is not stored.

Now I have currently written the code of Javascript in the PHP code itself.

I will provide the code for my page below.

<body bgcolor="#f0f0f0">
    $xml = new DOMDocument("1.0","UTF-8");

    $rootTag = $xml->getElementsByTagName("document")->item(0);

    $dataTag = $xml->createElement("data");




echo "<script type=\"text/javascript\">
function Home()
<form action="index.php" method="post">
  <table cellspacing="20px" style="margin-left:500px;" id="atable">
    <td>User Name </td>
    <td> <input type="text" name="a" width="75" /> </td>    <!--Inserting textbox in the page with justified width-->

<td> Password </td>
<td> <input type="password" name="b" width="75" /> </td>    <!--Inserting textbox in the page with justified width-->
<input type="button" name="ok" value="Login" onclick="Home()"  />
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题