• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

zurück Button geht nur im Safari

_R_A_L_F_

Mitglied
Hallo,

ich habe folgendes Problem. Ich mache eine Abfrage, ob ein Eintrag in der Datenbank wirklich gelöscht werden soll. Diese kann mann dann mit einem Button "Eintrag endgültig löschen" oder "zurück zur Übersicht" beantworten mittels klick.

Das Problem ist, im Safari gehts das wunderbar. Im Firefox aber nicht. Da wird der Link nicht geöffnet.

Komisch ist nur:
Wenn der Beitrag erfolgreich gelöscht wurde, ist auch nochmal der gleiche Button "zurück zur Übersicht" vorhanden. Bei dem funktioniert es.

Hier mal der Code:
PHP:
<?php session_start();

header("Content-Type: text/html; charset=utf-8");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>G&auml;stebuch - Abfrage wirklich l&ouml;schen</title>

<link href="/home/css/form.css" rel="stylesheet" type="text/css" />

<style type="text/css">

h1 {
    font-family: "Arial Black", Gadget, sans-serif;
    color: #636363;
    font-size: 16px;
    text-align: center;
}
h2 {
    font-family: "Arial Black", Gadget, sans-serif;
    color:#0066CC;
    font-size: 12px;
    text-align: left;
    display: inline;
}
h3 {
    font-family: "Arial Black", Gadget, sans-serif;
    color:#00CC33;
    font-size: 12px;
    text-align: left;
    display: inline;
}
h4 {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 12px;
    font-weight: bold;
    color: #999999;
    text-align: left;
    text-decoration: none;
    display: inline;
}

h5 {
    font-family: "Arial Black", Gadget, sans-serif;
    color:#FFFFFF;
    font-size: 14px;
    text-align: center;
    display: inline;
}

a:link {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 12px;
    font-weight: bold;
    color: #999999;
    text-align: left;
    text-decoration: none;
}

a:visited {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 12px;
    font-weight: bold;
    color: #999999;
    text-align: left;
    text-decoration: none;
}

a:hover {
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 12px;
    font-weight: bold;
    color: #D23600;
    text-align: left;
    text-decoration: none;
}

.ok
{
    background-color:#00CC33;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    width:65%;
    height: 30%;
    text-align: center;
    margin-right: auto;
    margin-left: auto;
}

</style>


</head>

<body>
<?php

// Datenbank Verbindung
include('connect.php');

// Wenn Button ja betätigt
if (!isset($_POST['submit'])){
   
echo "<p><h1>Soll der folgende Eintrag wirklich gel&ouml;scht werden?</h1>";
echo "<br />";
$sql = " SELECT * FROM gaestebuch WHERE id='". $_GET['id'] ."'";
if ( ! $db_link )
{
    die('keine Verbindung zur Zeit möglich -
         später probieren ');
}
// ausführen des mysql-Befehls
$db_erg = mysql_query( $sql );
if ( ! $db_erg )
{
    die('Ungültige Abfrage: Abfrage Eintrag ausw&auml;hlen:' . mysql_error());
}

// Alte Werte schreiben
$daten = mysql_fetch_object($db_erg);
$name = $daten->name;
$eintrag = $daten->eintrag;
// ID in Session Variable speichern
$_SESSION['id_loesch'] = $daten->id;

// Uhrzeit und Datum in deutsches Format wandeln
$datum_de = date("d.m.Y", strToTime( $daten->datum));
$uhrzeit_de = date("H:i", strToTime( $daten->datum));
       
// Smilies einfügen
include ('smile.php');

     echo '<table width="90%" border="0" align="center">
  <tr bgcolor=#F5F2CD> 
    <td width="10%"><h2>&nbsp;ID:</h2><h3> '.$daten->id.'</h3></td> 
    <td width="20%"><center><h3>'.$datum_de.' - '.$uhrzeit_de.'</h3></center></td>
    <td width="50%"><h2>&nbsp;Name:</h2><h3> '.$daten->name.'</h3></td>
    <td width="10%"><center>'.$freigeschalten.'</center></td>    
  </tr>
           </table>
 
  <table width="90%" border="0" align="center">
  <tr bgcolor=#F6E6B1> 
   <td width="100%">&nbsp; <h3>'.$inhalt.' <h3></td>
  </tr> 
           </table>
    ';
    
// Ressource wieder freigeben   
mysql_free_result( $db_erg );

}
else
{
   
// Session Variable zuweisen
$id = $_SESSION['id_loesch'];   
   
//SQL Befehl 
$sql = " DELETE FROM gaestebuch WHERE id = '$id' ";
if ( ! $db_link )
{
    // hier sollte dann später dem Programmierer eine
    // E-Mail mit dem Problem zukommen gelassen werden
    // die Fehlermeldung für den Programmierer sollte
    // das Problem ausgeben mit: mysql_error()
    die('keine Verbindung zur Zeit möglich -
         später probieren ');
}
// ausführen des mysql-Befehls
$db_erg = mysql_query( $sql );
if ( ! $db_erg )
{
    die('Ungültige Abfrage Eintrag l&ouml;schen: ' . mysql_error());
}

echo '<br /><div class="ok"><h5><center><br />Eintrag mit der ID: '.$_SESSION['id_loesch'].' wurde erfolgreich gel&ouml;scht</h5><br /></center></div><br /><br /><center><a href="admin_gae_loesch.php">
    <input type="submit" class="button submit" name="zruck" title="zur&uuml;ck zur &Uuml;bersicht" value="zur&uuml;ck zur &Uuml;bersicht" /></a>';
exit;   

}
?>

<form name="Formular" action="<?php echo $_SERVER['PHP_SELF']; ?>"
method="POST" >
<p>
<table width="35%" align="center" border="0">
<tr>
<td>
<center>
<a href="admin_gae_loesch.php">
    <input type="submit" class="button submit" name="zruck" title="zur&uuml;ck zur &Uuml;bersicht" value="zur&uuml;ck zur &Uuml;bersicht" /></a></center></td>
<td>
<center>
    <input type="submit" class="buttonloesch submitloesch" name="submit" title="Eintrag endg&uuml;ltig l&ouml;schen" value="Eintrag endg&uuml;ltig l&ouml;schen" /></center>
</td>
</tr>
</table>
</form>

</p>
</body>
</html>



Die Form.css Datei sieht wie folgt aus:
HTML:
form.formular {
font-family: tahoma, verdana, "sans-serif";
font-size: 12px;
padding: 20px;
border: 1px solid #A5A8B8;
background: #EAEAEA;
}

form.black {
font-family: tahoma, verdana, "sans-serif";
font-size: 12px;
padding: 20px;
border: 1px solid #A5A8B8;
background:#666666;
color:#CCCCCC;
}

form.black legend{
color:#CCCCCC;
}

.formular fieldset {
margin-top: 20px;
padding : 15px;
border: 1px solid #B5B8C8;   

}

.formular legend {
font-size: 12px;
color: #15428B;
font-weight: 900;
}

.formular fieldset label {
float: none;
text-align: inherit;
width: auto;
}

.formular label span {
color: #000;
}

.black label span {
color: #ccc;
}

.formular input, .formular select, .formular textarea {
display : block;
margin-bottom: 5px;
}

.formular .text-input {
width: 250px;
color: 555;
padding: 4px;
border: 2px solid #B5B8C8;
font-size: 14px;
margin-top: 4px;
background: #FFF url('/img/form/text-bg.gif') repeat-x;

}

.text-input {
width: 250px;
color: #555;
padding: 4px 4px 3px;
border: 2px solid #B5B8C8;
font-size: 14px;
margin-top: 4px;
margin-bottom: 4px;
background: #FFF url('/img/form/text-bg.gif') repeat-x;

}

.formular .capt-input {
width: 50px;
color: 555;
padding: 4px;
border: 2px solid #B5B8C8;
font-size: 14px;
margin-top: 4px;
background: #FFF url('/img/form/text-bg.gif') repeat-x;

}

.capt-input {
width: 100px;
color: #555;
padding: 4px 4px 3px;
border: 2px solid #B5B8C8;
font-size: 14px;
margin-top: 4px;
margin-bottom: 4px;
background: #FFF url('/img/form/text-bg.gif') repeat-x;

}

.formular .infos {
background: #FFF;
color: #333;
font-size: 12px;
padding: 10px;
margin-bottom: 10px;
border:1px solid #B5B8C8;
}

.formular span.checkbox,
.formular .checkbox {
display: inline;
}

.formular .button {
text-align:right;
margin-top: 20px;
}

.submit {
color: #555;
float:center;
text-decoration: none;
}

.submitloesch {
color: #F00;
float:center;
text-decoration: none;
}

.submitbearb {
color: #F90;
float:center;
text-decoration: none;
}

.submitok {
color: #0C3;
float:center;
text-decoration: none;
}


.formular a.submit {
background: url('/img/form/button-bg.png') repeat-x;
border: 1px solid #AAA;
padding: 4px;
}

input.button {
background: url('/img/form/button-bg.png') repeat-x;
border: 2px solid #AAA;
padding: 4px 4px 1px;
font-size:14px;
margin-top:4px;
}

input.buttonloesch {
background: url('/img/form/button-bg.png') repeat-x;
border: 2px solid #F00;
padding: 4px 4px 1px;
font-size:14px;
margin-top:4px;
}

input.buttonbearb {
background: url('/img/form/button-bg.png') repeat-x;
border: 2px solid #F90;
padding: 4px 4px 1px;
font-size:14px;
margin-top:4px;
}

input.buttonok {
background: url('/img/form/button-bg.png') repeat-x;
border: 2px solid #0C3;
padding: 4px 4px 1px;
font-size:14px;
margin-top:4px;
}

.formular input {
background: url('/img/form/button-bg.png') repeat-x;
border: 2px solid #AAA;
padding: 4px;
}

.formular hr {
clear: both;
visibility: hidden;
}

.formular .fc-error {
width: 350px;
color: 555;
padding: 4px;
border: 1px solid #B5B8C8;
font-size: 12px;
margin-bottom: 15px;
background: #FFEAEA;
}

form textarea {
    resize: none;
}

Wie gesagt, es funktioniert nur die Sache mit dem Button zurück nicht. Der Rest geht, deshalb auch HTML Thema.

Vielen Dank schon mal
 
Diese Kombination
PHP:
<a href="admin_gae_loesch.php"> <input type="submit" class="button submit" name="zruck" title="zur&uuml;ck zur &Uuml;bersicht" value="zur&uuml;ck zur &Uuml;bersicht" /></a>
ist völliger Quatsch, du kannst einen Button nicht verlinken.

Und was soll das:
PHP:
<?php
header("Content-Type: text/html; charset=utf-8");
?>
 
Ja ok, aber der verlinkte Button klappt ja im safari. Wie muss der Button dann ausschaun damit es klappt?

Header ist falsch, hab ich falsch mit kopiert, Sorry.
 
Hallo @_R_A_L_F_ ,

_R_A_L_F_ schrieb:
Ja ok, aber der verlinkte Button klappt ja im safari.
weil der eine blöde Browser aus dein fehler zufällig genau das macht was wolltest, müssen das andere Browser nicht auch machen :O)

vielleicht hilft das

HTML:
<button class="submit" style="width:200px;" onclick="window.open('http://www.deinlink?idnr=<? echo $termin; ?>','_blank','');return false;">text</button>

Cheffchen
 
Danke für die Antworten.

Also ich hab jetzt mal die Methode von dir Cheffchen ausprobiert. So würde es schon klappen NUR ich will ja nicht in einem neuem Fenster die Seite öffnen sondern im gleichen Fenster. Wie geht muss der Code dann aussehen?

So würde das mit der gleichen Seite klappen, aber das Problem ist, dass der Button in einem Frame ist. Und der Link sollte auch wieder im gleichen Frame geöffnet werden.

HTML:
<input type="submit" class="button submit"  onclick="top.location.href='admin_gae_loesch.php'" target="frame" name="zruck" title="zur&uuml;ck zur &Uuml;bersicht" value="zur&uuml;ck zur &Uuml;bersicht" />

Schon mal Danke
 
Zuletzt bearbeitet:
Das habe ich auch schon gehört. Sollte ich das ganze dann über <div> Container lösen oder wie macht man das am besten?

Du weißt aber nicht zufälliger weiße die Lösung mit dem Button?
 
Zurück
Oben