Autor Zpráva
pito
Profil
Zdravim,

Mam losovaci soutez kde se tipuje 5 cisel z 40.Uzivatel naklika 5 cisel mam to pres checkbox a pote to odesle.Jenze me to vubec nechce odeslat do db.Nevim kde je chyba tady je kod:

<form action="tilotto_zpracuj.php" method="post">

	<TABLE WIDTH="383" ALIGN="center" CELLPADDING="0" CELLSPACING="0" BORDER="0">
		<tr>
		<td colspan="3" WIDTH="383" HEIGHT="64"><IMG SRC="img/vrsek.bmp" WIDTH="383" HEIGHT="65" BORDER="0" /></td>
		</tr>
		<tr>
		<td width="6" background="img/leva.bmp"><img src="img/z.gif" width=6 height=1></td>
		<td ALIGN="center" BACKGROUND="img/pozadi.bmp">
			<TABLE width="100%" border=0 cellpadding=0 cellspacing=0>
			<TR>
			<TD align="center"><font size="2"><b>
			Podat tiket na pátek 9.1.2009
				</b></font></TD></TR></TABLE>

				<br />
			
	<table border="0" cellspacing="0" cellpadding="1"  ALIGN="center">

<tr>
<td><input type="hidden" name="login" value="<?php echo ($_SESSION['prihlasen'] ? $_SESSION['login'] : '') ?>"></td>
</tr>
			<tr>
 <td align="right">1<input type="checkbox" name="tip" value="1">&nbsp;</td>
 <td align="right">2<input type="checkbox" name="tip" value="2">&nbsp;</td>
 <td align="right">3<input type="checkbox" name="tip" value="3">&nbsp;</td>
 <td align="right">4<input type="checkbox" name="tip" value="4">&nbsp;</td>
 <td align="right">5<input type="checkbox" name="tip" value="5">&nbsp;</td>
</tr>
<tr>
 <td align="right">6<input type="checkbox" name="tip" value="6">&nbsp;</td>
 <td align="right">7<input type="checkbox" name="tip" value="7">&nbsp;</td>
 <td align="right">8<input type="checkbox" name="tip" value="8">&nbsp;</td>
 <td align="right">9<input type="checkbox" name="tip" value="9">&nbsp;</td>
 <td align="right">10<input type="checkbox" name="tip" value="10">&nbsp;</td>
</tr>
<tr>
 <td align="right">11<input type="checkbox" name="tip" value="11">&nbsp;</td>
 <td align="right">12<input type="checkbox" name="tip" value="12">&nbsp;</td>
 <td align="right">13<input type="checkbox" name="tip" value="13">&nbsp;</td>
 <td align="right">14<input type="checkbox" name="tip" value="14">&nbsp;</td>
 <td align="right">15<input type="checkbox" name="tip" value="15">&nbsp;</td>
</tr>
<tr>
 <td align="right">16<input type="checkbox" name="tip" value="16">&nbsp;</td>
 <td align="right">17<input type="checkbox" name="tip" value="17">&nbsp;</td>
 <td align="right">18<input type="checkbox" name="tip" value="18">&nbsp;</td>
 <td align="right">19<input type="checkbox" name="tip" value="19">&nbsp;</td>
 <td align="right">20<input type="checkbox" name="tip" value="20">&nbsp;</td>
</tr>
<tr>
 <td align="right">21<input type="checkbox" name="tip" value="21">&nbsp;</td>
 <td align="right">22<input type="checkbox" name="tip" value="22">&nbsp;</td>
 <td align="right">23<input type="checkbox" name="tip" value="23">&nbsp;</td>
 <td align="right">24<input type="checkbox" name="tip" value="24">&nbsp;</td>
 <td align="right">25<input type="checkbox" name="tip" value="25">&nbsp;</td>
</tr>
<tr>
 <td align="right">26<input type="checkbox" name="tip" value="26">&nbsp;</td>
 <td align="right">27<input type="checkbox" name="tip" value="27">&nbsp;</td>
 <td align="right">28<input type="checkbox" name="tip" value="28">&nbsp;</td>
 <td align="right">29<input type="checkbox" name="tip" value="29">&nbsp;</td>
 <td align="right">30<input type="checkbox" name="tip" value="30">&nbsp;</td>
</tr>
<tr>
 <td align="right">31<input type="checkbox" name="tip" value="31">&nbsp;</td>
 <td align="right">32<input type="checkbox" name="tip" value="32">&nbsp;</td>
 <td align="right">33<input type="checkbox" name="tip" value="33">&nbsp;</td>
 <td align="right">34<input type="checkbox" name="tip" value="34">&nbsp;</td>
 <td align="right">35<input type="checkbox" name="tip" value="35">&nbsp;</td>
</tr>
<tr>
 <td align="right">36<input type="checkbox" name="tip" value="36">&nbsp;</td>
 <td align="right">37<input type="checkbox" name="tip" value="37">&nbsp;</td>
 <td align="right">38<input type="checkbox" name="tip" value="38">&nbsp;</td>
 <td align="right">39<input type="checkbox" name="tip" value="39">&nbsp;</td>
 <td align="right">40<input type="checkbox" name="tip" value="40">&nbsp;</td>
</tr>
				</table>

				<br><br><br>
				<table border="0" cellspacing="0" cellpadding="0" ALIGN="center">
					<TR>
					<TD><input <input type="reset" value="vymazat" name="buttonreset" onclick="resetform(); return false;"></TD>
					<TD>&nbsp;</TD>
					<TD></TD>
					<TD>&nbsp;</TD>
					<TD><input type="submit"  name="sent" value="Podat tiket"></TD>
					</TR>
				</TABLE>
				<br /></TD>
			

		<td width="6" background="img/pravy.bmp"><img src="img/z.gif"  height=1></td>
		</tr>

		<TR><TD colspan="3"><IMG SRC="img/spodek.bmp" WIDTH="383" HEIGHT="19" BORDER="0"></TD></TR>
	</TABLE></FORM>




a tady co to ma spracovat do db:
tilotto_zpracuj.php

<?php
ob_start();               // cachujeme vystup
  if(isset($_POST['sent'])){      // pokud byl odeslan formular pokracuj timto
    $login=trim($_POST['login']);
    $tip=trim($_POST['tip']);
     if($login=="" or $tip==""){ // pokud nebylo vyplněno něco z toho, co je povinné, dáme vědět a skript ukončíme
      echo "Nebyly vyplněny všechny povinné údaje!";
    }else{              // povinné udaje vyplněny vsechny
      require "db.php";     // pripojime se k databazi
      $PocetStejnych=mysql_result(mysql_query("SELECT COUNT(*) FROM `tiplotto` WHERE `login`='$login'"),0);
      if($PocetStejnych!=0){    // pokud v db je jiz takovy login
        echo "Už jste poslal tiket na aktuální kolo!
      }    $VlozData=mysql_query("INSERT INTO tiplotto VALUES ('', '$login', '$tip')") or die (mysql_error());
        // Vlozim do tabulky hodnoty - prvni je ID - nevyplnim, tvori se samo.
        header ("Location: index.php?id=odeslano");
      }
  }else{
    echo "Nebyl odeslán formulář";
  }
// pokud pouzijete HEADER LOCATION tak by pred nim nemelo byt zadne platne ECHO

// samozrejme zde muze byt presmerovani na jinou stranku pomoci
// header ("Location: index.php");
ob_end_flush();
?>
pito
Profil
uz to mam omlouvam se
Toto téma je uzamčeno. Odpověď nelze zaslat.