Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Prüfen von Formularangaben

Empfohlene Antworten

Veröffentlicht

Hallo,

ich habe ein Formular in dem ich bestimmte Plausiprüfungen einbauen will.

Wenn ich nun alles in einem PHP File mache ist für mich die Situation klar.

Nun habe ich aber folgende Situation

Formular:

function nominierForm() {
?>
<h1 class="servicesun_comhead">Firma nominieren</h1>
<div style='width:95%'>
<p></p>
</div>
<form name="nominierung" method="post" action="index.php" enctype="multipart/form-data">
<table width="569" border="0">
<tr><td><b>Meine Daten<br></b></td><td>(Angaben sind freiwillig, dienen nur ServiceSun intern)</td></tr>
<tr><td> </td></tr>
<td >Ihr Name:</td>
<td ><input type="text" name="Kundename" class="servicesun_nomform_mittel_ID">ID:
<input type="text" name="MA-ID" size="5" ...
...
...
...


<td colspan="2">
<textarea name="SonstigeMitteilung" id="SonstigeMitteilung" class="servicesun_nomform_textbox"></textarea> </td>
</tr><tr>
<td colspan="2" >  </td>
</tr>
<tr>

<td colspan="2">
<input type='HIDDEN' name='option' value='com_servicesun'>
<input type='HIDDEN' name='task' value='save'>
<input type="submit" name="Abschicken" value="Abschicken" class='servicesun_button'> <input type="reset" name="Zurücksetzen" value="Zurücksetzen" class='servicesun_button'>
</td>
</tr>

<tr>

</tr>

</table>

</form>

<?php
}
[/PHP]

Funktion saveandmail

[PHP]function saveAndMail(){
global $database;
/// VARIABLENDECLARATION
///
$TG_Name=$_POST['Kundename'];
...
...
...
...
...
Hier werden Mail versendet und die Daten in eine DB gespeichert.

Wenn ich dieses Formular absende wird die Funktion saveandMail aus der Klasse aufgerufen.

Natürlich kann ich in der Funktion save and Mail die Werte prüfen, ich möchte aber das ausgefüllte Formular weiterhin anzeigen und bei den Felder die Fehlerhaft sind einen Kommentar in "rot" setzen.

Ich denke ich müsste das Formular mit action=PHP_SEL. Anlegen wie kann ich aber nach erfolgreicher Prüfung die Daten an meine bereits vorhandene Funktion saveandMail senden?

wie kann ich aber nach erfolgreicher Prüfung die Daten an meine bereits vorhandene Funktion saveandMail senden?

Ganz einfach:


.
.
// hier wird geprüft
.
.
if ([erfolgreich geprüft]) {
saveandmail();
} else {
// Fehlermeldung
// usw.
nominierForm();
}
[/PHP]

Gruß

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.