|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
edwin12345 Smarty n00b
Joined: 08 Jan 2017 Posts: 2
|
Posted: Sat May 13, 2017 11:38 pm Post subject: Foreach Datenbankauswertung ID |
|
|
Hallo Leute habe mit Smarty nun neu begonnen und stehe vor einem kleinen Problem und ich komme einfach nicht drauf.
Ich bereite mir mittels foreach die Daten aus der Datenbank auf und gebe Sie dann in einer Tabelle aus. Das funktioniert alles einwandfrei. Nur möchte ich nun Anhand der K_ID welche aus der DB kommt weiterarbeiten sodass ich Werte löschen etc. kann.
Ich habe auch schon die entsprechenden Buttons nur erhalte ich genau bei einem Button den gewünschten Wert zurück und bei den anderen nicht mehr.
Code: |
.tpl Datei
{foreach $ausw as $auswertung}
<tr>
<td>{$auswertung.k_id}<br></td>
<td>{$auswertung.vorname}<br></td>
<td>{$auswertung.nachname}<br></td>
<td>{$auswertung.adresse}<br></td>
<td>{$auswertung.postleitzahl}<br></td>
<td><button type="submit" class="btn btn-primary btn-md" name="auswahl" id="deleter" value="{$auswertung.k_id}"></td>
{counter}
{debug}
</tr>
{/foreach}
|
Code: |
.php Datei[JavaScript]
$('#deleter').click(function(){
var k_id = $("#deleter").val();
alert($("#deleter").val());
/*
$.ajax({
url: "ajax.php",
type: "POST",
data: { ACTION : "loeschen", K_ID : k_id},
dataType: "text",
success: function(data){
//$('#kunde_hinzu').modal('hide');
window.location = "kunden.php";
alert("Der Datensatz wurde gelöscht");
},
error: function(xhr, status, error){
alert(error + " Fehler beim Löschen");
}
});
*/
});
|
Danke für eure Hilfe |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun May 14, 2017 12:25 am Post subject: |
|
|
I don't see how this is a Smarty question.
If the HTML your template produces matching your expectations, nothing more Smarty can do.
If you have a question about JQuery - you are on the wrong forum. |
|
Back to top |
|
edwin12345 Smarty n00b
Joined: 08 Jan 2017 Posts: 2
|
Posted: Sun May 14, 2017 7:33 am Post subject: |
|
|
Problem behoben, hatte einen kleinen Denkfehler im JQuery |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|