Я довольно новичок в кодировании и уже некоторое время пытаюсь понять, как это сделать, и, похоже, не могу понять. Итак, у меня есть HTML форма внутри PHP файла. Вот как выглядит моя форма ввода с CSS.
@import url('https://fonts.googleapis.com/css2?family=Baloo+2&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@600&display=swap');
.maincatalougetable {
border: 3px black solid;
font-family: 'Baloo 2', cursive;
margin-left: 13%;
width: 20%;
}
.bodytitle {
font-family: 'Source Sans Pro', sans-serif;
text-align: center;
}
.bodysubtitle {
font-family: 'Baloo 2', cursive;
text-align: center;
font-size: 15px;
margin-top: -5px;
}
.td, th {
border: 2px solid #3a2e2e;
text-align: left;
padding: 10px;
}
.background {
background-color: rgb(61, 61, 145);
}
.body {
background-color: rgb(212, 195, 195);
border: 3px solid blueviolet;
width: 80%;
margin-left: 10%
}
.hr {
width: 10%;
}
.plateactimg {
width: 150px;
padding: -10px;
}
.basictitle {
color: black;
font-family: 'Baloo 2', cursive;
}
.basicinput {
font-family: 'Baloo 2', cursive;
border: 3px solid black;
border-radius: 5px;
width: 200px;
height: 20px;
font-size: 20px;
}
.inputbody {
background-color: blueviolet;
}
.postbutton {
font-family: 'Baloo 2', cursive;
border: 3px rgb(0, 174, 255) solid;
border-radius: 2px;
width: 100px;
height: 30px;
background-color: white;
font-size: 15px;
}
.postbutton:hover {
background-color: rgb(147, 147, 187);
transition: 0.2s;
cursor: pointer;
}
.adminheader {
height: 100px;
background-color: black;
margin-top: -34px;
margin-left: -8px;
width: 101%;
}
.admintitle {
font-family: 'Source Sans Pro', sans-serif;
color: white;
padding: 10px;
font-size: 50px;
}
.basicfile {
font-family: 'Baloo 2', cursive;
border: 3px rgb(0, 174, 255) solid;
border-radius: 2px;
width: 300px;
height: 30px;
background-color: white;
font-size: 15px;
}
.basicfile:hover {
background-color: rgb(147, 147, 187);
transition: 0.2s;
cursor: pointer;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>repl.it</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body class="inputbody">
<div class="adminheader">
<h1 class="admintitle">Administrator Panel</h1>
</div>
<form action="/action_page.php">
<label class="basictitle" for="type">Type (i.e. Yukon Passenger Plate):</label><br>
<input class="basicinput" type="text" id="type" name="type"><br>
<label class="basictitle" for="year">Year:</label><br>
<input class="basicinput" type="text" id="year" name="year"><br>
<label class="basictitle" for="condition">Condition:</label><br>
<input class="basicinput" type="text" id="condition" name="condition"><br>
<label class="basictitle" for="platenumber">Plate Number (i.e. 1-283):</label><br>
<input class="basicinput" type="text" id="platenumber" name="platenumber"><br>
<label class="basictitle" for="price">Price (Without shipping costs):</label><br>
<input class="basicinput" type="text" id="price" name="price"><br>
<label class="basictitle" for="imagepath">Image File Name (With the extension i.e. yukon1.png):</label><br>
<input class="basicinput" type="text" id="price" name="price"><br>
<label class="basictitle" for="misc">Miscellaneous (Optional):</label><br>
<input class="basicinput" type="text" id="misc" name="misc"><br>
<br>
<input class="postbutton" type="submit" value="Upload">
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" class="basicfile"mname="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
</form>
</body>
</html>
Поэтому, как только вы введете желаемый вход в поля ввода и загрузите желаемое изображение, я бы хотел файл в главном каталоге с именем 'maincatalougetable. php ', который нужно изменить таким образом, чтобы входные данные, которые были введены в формы в файле, который я показал выше (называемый newlisting. php), заменят неопределенные переменные в фрагменте, показанном ниже. Я считаю, что это можно сделать, изменив текст, введенный в формы, с помощью JS, а затем отредактировав файл maincatalougetable. php, чтобы он отображался в главном каталоге. Ниже я включил файл maincatalouge. php и то, как я хочу, чтобы он был изменен. Я думаю, что это лучший способ сделать то, что я хочу, но я довольно новичок в этом. Спасибо!
@import url('https://fonts.googleapis.com/css2?family=Baloo+2&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@600&display=swap');
.maincatalougetable {
border: 3px black solid;
font-family: 'Baloo 2', cursive;
margin-left: 13%;
width: 20%;
}
.bodytitle {
font-family: 'Source Sans Pro', sans-serif;
text-align: center;
}
.bodysubtitle {
font-family: 'Baloo 2', cursive;
text-align: center;
font-size: 15px;
margin-top: -5px;
}
.td, th {
border: 2px solid #3a2e2e;
text-align: left;
padding: 10px;
}
.background {
background-color: rgb(61, 61, 145);
}
.body {
background-color: rgb(212, 195, 195);
border: 3px solid blueviolet;
width: 80%;
margin-left: 10%
}
.hr {
width: 10%;
}
.plateactimg {
width: 150px;
padding: -10px;
}
.basictitle {
color: black;
font-family: 'Baloo 2', cursive;
}
.basicinput {
font-family: 'Baloo 2', cursive;
border: 3px solid black;
border-radius: 5px;
width: 200px;
height: 20px;
font-size: 20px;
}
.inputbody {
background-color: blueviolet;
}
.postbutton {
font-family: 'Baloo 2', cursive;
border: 3px rgb(0, 174, 255) solid;
border-radius: 2px;
width: 100px;
height: 30px;
background-color: white;
font-size: 15px;
}
.postbutton:hover {
background-color: rgb(147, 147, 187);
transition: 0.2s;
cursor: pointer;
}
.adminheader {
height: 100px;
background-color: black;
margin-top: -34px;
margin-left: -8px;
width: 101%;
}
.admintitle {
font-family: 'Source Sans Pro', sans-serif;
color: white;
padding: 10px;
font-size: 50px;
}
.basicfile {
font-family: 'Baloo 2', cursive;
border: 3px rgb(0, 174, 255) solid;
border-radius: 2px;
width: 300px;
height: 30px;
background-color: white;
font-size: 15px;
}
.basicfile:hover {
background-color: rgb(147, 147, 187);
transition: 0.2s;
cursor: pointer;
}
<table class="maincatalougetable">
<tr>
<th class="plateimagetag">Image</th>
<th class="platenametag">Type</th>
<th class="plateyeartag">Year</th>
<th class="platecondtag">Condition</th>
<th class="platenumbertag">Number</th>
<th class="platepricetag">Price</th>
<th class="platemisctag">Miscellaneous</th>
<th class="platecontacttag">Inquire</th>
</tr>
<tr>
<th class="plateimage"><img class="plateactimg" src="yukon1-762.JPG"> </th>
<th class="platename">I want the plate name input from the newlisting.php file to show up here, and create new columns as more are added. </th>
<th class="plateyear">I want the plate year input from the newlisting.php file to show up here, and create new columns as more are added.</th>
<th class="platecond">I want the plate condition input from the newlisting.php file to show up here, and create new columns as more are added.</th>
<th class="platenumber">I want the plate number input from the newlisting.php file to show up here, and create new columns as more are added.</th>
<th class="plateprice">I want the plate price input from the newlisting.php file to show up here, and create new columns as more are added.</th>
<th class="platemisc">I want the plate misc input from the newlisting.php file to show up here, and create new columns as more are added.</th>
<th class="platecontact"><a href="mailto:safteyman@northwestel.net?subject=1960 Yukon Passenger Plate VG+">E-mail</a></th>
</tr>
</table>