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.

Aufrufen einer Funktion

Empfohlene Antworten

Veröffentlicht

Hi!

Ich hab ein Problem, und zwar wird der code hinter dem formular nicht durchgeführt. Ich poste jetzt mal den ganzen code hier rein.


<?php


//Loginfunktion


function login()

{	

	echo "<form name=\"Login\" method=\"get\" action=\"$PHP_SELF\">";

	echo "<table align=\"center\" width=\"80%\" height=\"100%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";

	echo "		<tr>";

	echo "			<td width=\"40%\" height=\"10\">";			

	echo "			</td>";

	echo "			<td width=\"*\" height=\"10\">";

	echo "			</td>";

	echo "		</tr>";

	echo "		<tr>";	

	//Hauptfeld

	echo "			<td align=\"left\" height=\"10\" width=\"20%\">";

	echo "				Loginname:";

	echo "			</td>";

	echo "			<td align=\"left\" height=\"10\" width=\"*\">";

	echo "				<input type=\"text\" name=\"Loginname\" size=\"20\" maxlength=\"40\">";

	echo "			</td>";

	echo "		</tr>";

	echo "		<tr>";

	echo "			<td align=\"left\" height=\"15\" width=\"20%\">";

	echo "				Passwort:";

	echo "			</td>";

	echo "			<td align=\"left\" height=\"15\" width=\"*\">";

	echo "				<input type=\"password\" name=\"Passwort\" size=\"20\" bgcolor=\"#666699\">";

	echo "			</td>";

	echo "		</tr>";

	echo "		<tr>";

	echo "			<td align=\"right\" height=\"15\" width=\"20%\">";

	echo "				<input type=\"submit\" name=\"Submit\" value=\"Einloggen\">";

	echo "			</td>";

	echo "			<td align=\"left\" height=\15\" width=\"*\">";

	echo "				<input type=\"reset\" name=\"Reset\" value=\"Zurücksetzen\">";

	echo "			</td>";

	echo "		</tr>";

	echo "		<tr>";

	echo "			<td height=\"10\" width=\"20%\">";

	echo "			</td>";

	echo "			<td height=\"10\" width=\"*\">";

	echo "			</td>";

	echo "		</tr>";

	echo "		<tr>";

	echo "			<td align=\"left\" height=\"20\" width=\20%\">";

	echo "				<a href=\"default.php?id=Passwort vergessen\">Passwort vergessen?</a>";

	echo "			</td>";

	echo "			<td align=\"left\" height=\"20\" width=\"15\">";

	echo "			</td>";

	echo "		</tr>";

	//Seitenrand

	echo "		<tr>";

	echo "			<td height=\"30\" width=\"40\">";


	echo "			</td>";

	echo "			<td height=\"30\" width=\"15\">";

	echo "			</td>";

	echo "		</tr>";


	//Untere Zelle

	echo "		<tr>";

	echo "			<td height=\"150\" width=\"40\">";

	echo "			</td>";

	echo "			<td height=\"150\" width=\"15\">";

	echo "			</td>";

	echo "		</tr>";

	echo "	</table>";

	echo "</form>";


	if($Submit == true){	



	$host = "host";

	$user = "user";

	$pwd  = "password";


	if($Passwort == false || $Loginname == false) {

    		 echo "Bitte geben Sie ein Passwort und einen Loginnamen ein!!";

	}

	else

	{


    		$link = @mysql_pconnect ($host, $user, $pwd)

        		or die ("Could not connect");

    		//Zur Fehlersuche; bei Bedarf wieder auskommentieren

    		//echo "Connection to database successfully established";


    		mysql_select_db ("dbase")

        		or die ("Could not select database");


		//SQL Anfrage 

    		$query = ("SELECT Pwd FROM Logindaten WHERE KNr = '$Loginname'");

    		$result = mysql_query($query)

   			or die("Query failed!");



    		$row = mysql_fetch_array($result);



    		if($row["Pwd"] == $Passwort ) {

  			echo "Login successful";

  			echo "<meta http-equiv=\"refresh\" content=\"1;URL=user.php?&Kundenname=$Kundenname&Passwort=$Passwort\">";

  		}

    		else {

    			echo "Login not successful";

    		}

	}   

   	@mysql_close ($link);	

}	

}

//Ende Loginfunktion


Diese Funktion (login()) wird in der datei default.php in einer switch Anweisung ausgeführt.

Danke schon mal im voraus

php erzeugt statische HTML Seiten, was du haben willst ist dass das Script durchläuft sobald das Formular abgeschickt wurde, das geht so aber nicht. Der php Interpreter nimmt deine Formulardaten an und startet ein neues Script und führt nicht, wie du es erhoffst, das alte fort !

Ich hoffe das war verständlich erklärt ??

soll ich dann die zeilen hinter dem formular in eine neue php datei einfügen und dann in action eingeben?

wozu brauch ich dann das $PHP_SELF?

das Problem hier ist, dass er immer zuerst im Formular landet, damit hast du schon verloren. Du musst anhand der Formulardaten dort vorbeischiffen, zB. zuerst auf den submit Testen, und wenn schon ein Value da ist brauchste das Formular nimmer.

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.