I've database with a table 'history'
id title subtitle file
---------------------------- ----------------------------- -------------------------------------
2 SeriesA*SeriesB*SeriesC SessionA*SessionB*SessionC Mircosoft.doc*Windows.docx*Server.doc
4 Objective*Punc*Blank Shorttype*Paragraph*Match Mircosoft.doc*Windows.docx*Server.doc
I want to fetch title, subtitle and file of that ID, to html input values.
$id = $_GET['id'];
$get_history = mysqli_query($mysqli, "SELECT * FROM history WHERE id=".$id."");
$rows = array();
while($row = mysqli_fetch_assoc($get_history))
$rows[] = $row;
foreach($rows as $row) {
$title = explode("*" , $row['title']);
$subtitle = explode("*" , $row['subtitle']);
$file = explode("*" , $row['file']);
}
<html>
<body>
Title: <input type="text" name="name[]" value="<?php echo $title; ?> "/><br>
Subtitle: <input type="text" name="title[]" value="<?php echo $subtitle; ?> "/><br>
File: <input type="file" name="file[]" value="<?php echo $file; ?> "/><br>
<input type="button" class="add" value="Add"/><br>
<input type="submit" value="submit" name="submit">
</body>
</html>
I need the output like when id=2 :
Title : SeriesA
Subtitle: SessionA
File: Mircosoft.doc
---------------------
Title : SeriesB
Subtitle: SessionB
File: Windows.docx
---------------------
Title : SeriesC
Subtitle: SessionC
File: Server.doc