Am si eu o problema, si nu prea stiu sa ii dau de cap !
Am un select din DB ce creeaza un form de select in functie de campurile ID si mai jos alte 3 input text ce urmeaza a fi completate.De fapt acest form este destinat update-ului acelor informatii si mi-ar fi mai usor acele campuri vor avea "value" informatiile care deja sunt in db pentru campul respectiv.
Cum as putea face asta , intai Imi trebuie un script Js pentru formul de select.
Cod: Selectaţi tot
$sql = "SELECT * FROM welcome";
$rows = $conn->sqlExec($sql);
$nr_row = $conn->num_rows;
$pag .='
<span class="styleform"><h4>Edit About Section !</h4></span>
<br />
<script type="text/javascript" src="checkjs/welcome.js"></script>
<form method="post" action="aboutsend.php" onsubmit="return checkForm(this)";>
<table border="0" cellspacing="0" cellpadding="1" style="border:1px solid #888888; padding:1px;">
<tr><td><span class="styleform">Select Paragraph:</span></td><td>
<select name="paragraphs">
<option>Select Paragraph</option>
';
foreach($rows as $row) {
$first = $row['sttitle'];
$secont = $row['sectitle'];
$contents = $row['content'];
$pag .='<option value="'.$row['id'].'" >Paragraph '.$row['id'].'</option>'; // Aici se creeaza selectul
}
$pag .='
</select>
</td></tr>
<tr><td><span class="styleform">Principal Title About Us :</span></td><td><input type="text" name="sttitle" id="sttitle" size="50" value="'.$first.'" ></td></tr>
<tr><td><span class="styleform">Secont Title About Us :</span></td><td><input type="text" name="sectitle" id="sectitle" size="50" ></td></tr>
<tr><td><span class="styleform">Content About Us :</span></td>
<td><textarea name="content" id="content" rows="7" cols="52"></textarea></td></tr>
<tr><td><span class="styleform">Edit About Us:</span></td><td><input type="submit" name="updwelcome" value="Edit Info"></td></tr>
</table>
</form>
Multumesc mult !