tag ihr
hab hier n formular, und das problem ist, dass wenn man alles
richtig eingegeben hat, dass php dann trozdem nichts in mysql
einträgt. wiso?? was sit falsch???
hab hier n formular, und das problem ist, dass wenn man alles
richtig eingegeben hat, dass php dann trozdem nichts in mysql
einträgt. wiso?? was sit falsch???
PHP-Code:
<?php if(!isset($_POST['submit'])) { //wenn der submit button noch
nicht gedrückt wurde, dann kommt das hier:
?>
<form action="<?php $PHP_SELF ?>" method="post"
name="form">
<code>bandname here:</code><br>
<input type="text" size="40" name="band" class="input"
maxlength="25"
<?php if($_POST['band'] != "" ) {echo ' value="'.$_POST['band'].'"';}
?>><br><br> <hr style="border: 1px solid #4F4F4F"><br>
<code>songname here:</code><br>
<input type="text" size="40" name="song" class="input"
maxlength="25"
<?php if($_POST['song'] != "" ) {echo ' value="'.$_POST['song'].'"';}
?>><br><br><hr style="border: 1px solid #4F4F4F"><br>
<code>chose the instrument:</code><br>
<input type="Radio" name="instr" value="guitar"
<?if($_POST['instr'] == guitar){echo
"checked='checked'";}else{echo "";}?>
><code style="color: #FFFFFF;">guitar</code></input><br>
<input type="Radio" name="instr" value="bass"
<?if($_POST['instr'] == bass){echo "checked='checked'";}else{echo
"";}?>
><code style="color: #FFFFFF;">bass</code></input><br>
<input type="Radio" name="instr" value="drumms"
<?if($_POST['instr'] == drumms){echo
"checked='checked'";}else{echo "";}?>>
<code style="color: #FFFFFF;">drumms</code></input><br>
<input type="Radio" name="instr" value="lyrics"
<?if($_POST['instr'] == lyrics){echo "checked='checked'";}else{echo
"";}?>>
<code style="color: #FFFFFF;">lyrics</code></input>
<br><br> <hr style="border: 1px solid #4F4F4F"><br>
<code>tuning here:</code><br>
<input type="text" size="40" name="tuning" class="input"
maxlength="30"
<?php if($_POST['tuning'] != "" ) {echo '
value="'.$_POST['tuning'].'"';} ?>> <code>for example: e a d g b e
</code><input style="cursor: pointer;" type="button"
value="tunings" class="button" onClick="add('eadghe')"></input>
<a href="#" onclick="window.open('tunings.html', 'tuning',
'menubar=no,location=no,resizable=no,scrollbars=no,status=no,
width=200,height=200');">tunings</a>
<br><br><hr style="border: 1px solid #4F4F4F"><br>
<code>notes here:</code><br>
<textarea wrap="physical" type="text" class="textarea"
name="notes" size="24" border="1" cols="77" rows="5"><?php
if($_POST['notes'] != "" ) {echo $_POST['notes'];} ?></textarea>
<br> <br><hr style="border: 1px solid #4F4F4F"><br>
<code>tab here:</code><br>
<input style="cursor: pointer;" type="button" value="guitar strings"
class="button"
onClick="Hinzufuegen('|--------------------------------
-------------------------------|thin\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|thick\n\n\n\n\n')">
</input>
<input style="cursor: pointer;" type="button" value="bass strings"
class="button" onClick="Hinzufuegen('|---------------------------------------------
------------------|thin\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|thick\n\n\n\n\n')">
</input>
<input style="cursor: pointer;" type="button" value="drumms"
class="button" onClick="Hinzufuegen('\n')"></input><br>
<textarea wrap="physical" type="text" class="textarea"
name="tab" size="24" border="1" cols="77" rows="30"><?php
if($_POST['tab'] != "" ) {echo "tab";} ?></textarea> <br> <br><hr
style="border: 1px solid #4F4F4F"><br>
<input type="hidden" value="dimebag"></input>
<center><input type="submit" style="cursor: pointer;"
value=">> submit tab >>" class="button"> </center>
</form>
<?
}elseif(!$_POST['band'] || $_POST['band'] == "" ||
!$_POST['song'] || $_POST['song'] == "" ||
!$_POST['instr'] || $_POST['instr'] == "" ||
!$_POST['tuning'] || $_POST['tuning'] == "" ||
!$_POST['notes'] || $_POST['notes'] == "" ||
!$_POST['tab'] || $_POST['tab'] == "" ||
!$_POST['song'] || $_POST['song'] == "")
{
//wenn irgendetwas nicht ausgefüllt wurde wird das andere
formular mit dem error und den vorherigen eingaben aufgerufen
?>
<form action="<?php $PHP_SELF ?>" method="post"
name="form">
<code>bandname here:</code><br>
<input type="text" size="40" name="band" class="input"
maxlength="25"
<?php if($_POST['band'] != "" ) {echo ' value="'.$_POST['band'].'"';}
?>><br><br> <hr style="border: 1px solid #4F4F4F"><br>
<code>songname here:</code><br>
<input type="text" size="40" name="song" class="input" maxlength="25"
<?php if($_POST['song'] != "" ) {echo ' value="'.$_POST['song'].'"';} ?>><br><br><hr style="border: 1px solid #4F4F4F"><br>
<code>chose the instrument:</code><br>
<input type="Radio" name="instr" value="guitar"
<?if($_POST['instr'] == guitar){echo
"checked='checked'";}else{echo "";}?>
><code style="color: #FFFFFF;">guitar</code></input><br>
<input type="Radio" name="instr" value="bass"
<?if($_POST['instr'] == bass){echo "checked='checked'";}else{echo
"";}?>
><code style="color: #FFFFFF;">bass</code></input><br>
<input type="Radio" name="instr" value="drumms"
<?if($_POST['instr'] == drumms){echo
"checked='checked'";}else{echo "";}?>>
<code style="color: #FFFFFF;">drumms</code></input><br>
<input type="Radio" name="instr" value="lyrics"
<?if($_POST['instr'] == lyrics){echo "checked='checked'";}else{echo
"";}?>>
<code style="color: #FFFFFF;">lyrics</code></input>
<br><br> <hr style="border: 1px solid #4F4F4F"><br>
<code>tuning here:</code><br>
<input type="text" size="40" name="tuning" class="input"
maxlength="30"
<?php if($_POST['tuning'] != "" ) {echo '
value="'.$_POST['tuning'].'"';} ?>> <code>for example: e a d g b e
</code><input style="cursor: pointer;" type="button"
value="tunings" class="button" onClick="add('eadghe')"></input>
<a href="#" onclick="window.open('tunings.html', 'tuning',
'menubar=no,location=no,resizable=no,scrollbars=no,
status=no,width=200,height=200');">tunings</a>
<br><br><hr style="border: 1px solid #4F4F4F"><br>
<code>notes here:</code><br>
<textarea wrap="physical" type="text" class="textarea"
name="notes" size="24" border="1" cols="77" rows="5"><?php
if($_POST['notes'] != "" ) {echo $_POST['notes'];} ?></textarea> <br> <br><hr style="border: 1px solid #4F4F4F"><br>
<code>tab here:</code><br>
<input style="cursor: pointer;" type="button" value="guitar strings"
class="button" onClick="Hinzufuegen('|----------------------------------------------
-----------------|thin\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|thick\n\n\n\n\n')">
</input>
<input style="cursor: pointer;" type="button" value="bass strings" class="button" onClick="Hinzufuegen('|-------------------------
--------------------------------------|thin\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|\n
|---------------------------------------------------------------|thick\n\n\n\n\n')"
></input>
<input style="cursor: pointer;" type="button" value="drumms"
class="button" onClick="Hinzufuegen('\n')"></input><br>
<textarea wrap="physical" type="text" class="textarea"
name="tab" size="24" border="1" cols="77" rows="30"><?php
if($_POST['tab'] != "" ) {echo "tab";} ?></textarea> <br> <br><hr
style="border: 1px solid #4F4F4F"><br>
<input type="hidden" value="dimebag"></input>
<center><input type="submit" style="cursor: pointer;"
value=">> submit tab >>" class="button"> </center>
</form>
<?
}
else
{
include("./dateien/inc/connection.php");
$band = $_POST["band"];
$song = $_POST["song"];
$user = $_POST["user"];
$n1 = $_POST["notes"];
$instr = $_POST["instr"];
$tuning = $_POST["tuning"];
$t1 = $_POST["tab"];
$datum = time();
$letter = substr($band, 0, 1);
$t2 = nl2br($t1);
$t3 = str_replace (" ", " ", $t2);
$t4 = str_replace ("<", "<", $t3);
$t5 = str_replace (">", ">", $t4);
$n2 = nl2br($n1);
$n3 = str_replace (" ", " ", $n2);
$n4 = str_replace ("<", "<", $n3);
$n5 = str_replace (">", ">", $n4);
if ($letter == 1 or $letter == 2 or $letter == 3 or $letter == 4 or
$letter == 5 or $letter == 6 or $letter == 7 or $letter == 8 or $letter
== 9 ){
$stabe = 1;
}
else{
$stabe = $letter;
}
$aufgabe = "INSERT INTO tab (band, song, user, instrument, tuning,
tab, letter, datum, notes) VALUES ('$band', '$song', '$user', '$instr',
'$tuning', '$t5','$stabe', '$datum', '$n5')";
$eintragen = mysql_query($aufgabe) or die("fehlgeschlagen");
//Wurde der Eintrag erfolgreich gespeichert?
if($eintragen == true)
{
echo "Beitrag hinzugefügt du kannst ihn dir nun ansehen";
}
else
{
echo "Fehler versuchs nochmal";
}
}
?>
Kommentar