对不起,如果我要说些奇怪的话,我是php的新手。
在某些代码中(如果我尝试将其放在stackoverflow上将无法正确显示),我希望用户能够更改数组中给定的某些变量。但是,我注意到,如果用户更改了此变量,则该变量将变回先前所说的数组中所说的内容。确实如此吗?还是只要用户尝试更改数组,数组是否会保持不变?
用户可以通过在输入字段中输入自己的更改来更改数组,该字段显示为$Password['0'] = $_POST['InputFromTheUser']
(同样,如果我要尝试在此处粘贴ful lcode,stackoverflow不会接受它)
我犯错了吗,还是根本没有办法更改数组?
编辑: 这是代码
$ANaam = array("Wildhoven","van Boven","de Groot","van den Bent","Admin");//Maar als de array is aangepast wrod de array weer terug aangepast odmat hier iets staat. Er meot dus een manier zijn om deze array aan te passen
$Adres = array("Langlaan 1","Kortlaan 1","Breedlaan 1","LerarenkamerSMC","Admin");
$Postcode = array("2212GJ","8263SJ","1293OP","0000AA","Admin");
$Stad = array("Leiden","Delft","Voorschoten","Voorburg","Admin");
$Email = array("Marja@hotmail.nl","Kees@hotmail.nl","Hanna@hotmail.nl","bnt@st-maartenscollege.nl","Admin");
$Telefoonnummer = array("06 1234567","06 1110001","097","06 1098901","Admin");
$_SESSION["VNARRAY"] = $VNaam;
$_SESSION["ANARRAY"] = $ANaam;
$_SESSION["ADARRAY"] = $Adres;
$_SESSION["POARRAY"] = $Postcode;
$_SESSION["STARRAY"] = $Stad;
$_SESSION["EMARRAY"] = $Email;
$_SESSION["TEARRAY"] = $Telefoonnummer;
$IDG = $_SESSION["IDvanGebruiker"];
?>
<h1>
Uw TechN account
</h1>
<!-- Naam van klant -->
<br>
<p>
Gebruikersnaam: <?php echo $_SESSION["GNARRAY"]["$IDG"]; ?> <form method="post" action=""> <input type="text" name="AnderGN"> <input type="submit" name="AanpassenGN" value="aanpassen">
</p>
<?php if(isset($_POST['AanpassenGN']) && !empty($_POST["AnderGN"])){ $_SESSION["GNARRAY"]["$IDG"] = $_POST["AnderGN"]; header("Refresh:0"); } ?>
<p>
Wachtwoord: <?php echo $_SESSION["WWARRAY"]["$IDG"]; ?><form method="post" action=""> <input type="text" name="AnderWW"> <input type="button" name="AanpassenWW" value="aanpassen">
</p>
<?php ?>
<p>
Voornaam: <?php echo $_SESSION["VNARRAY"]["$IDG"]; ?> <form method="post" action=""> <input type="text" name="AnderVN"> <input type="submit" name="AanpassenVN" value="aanpassen">
</p>
<?php if(isset($_POST['AanpassenVN']) && !empty($_POST["AnderVN"])){ $_SESSION["VNARRAY"]["$IDG"] = $_POST["AnderVN"]; $VNaam["$IDG"] = $_POST["AnderVN"]; header("Refresh:0"); }?>
使用的某些词是荷兰语,因为我是荷兰语。