Formularz

PHP  Założony przez  marex112.

Witam.
Mam już zrobioną tabelę w bazie danych i chciałbym teraz móc odczytywać dane lub zapisywać do bazy danych tekst który będzie wpisywany w formularzu.
Pomoże ktoś?

http://spedistar.16mb.com/forum/oddajtrase.php

Strona z formularzem:

<!DOCTYPE html>
   <?php
   // podłączamy plik  bazadanych.php
   require "bazadanych.php";
   // wywołujemy funkcję polaczenie()
   polaczenie();
   ?>
<html lang="en">
  <head>
<title>SS VTC | Firmowy tachograf</title>
<!-- start: headerinclude -->
<link rel="alternate" type="application/rss+xml" title="Najnowsze wątki (RSS 2.0)" href="http://spedistar.16mb.com/forum/syndication.php" />
<link rel="alternate" type="application/atom+xml" title="Najnowsze wątki (Atom 1.0)" href="http://spedistar.16mb.com/forum/syndication.php?type=atom1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="http://spedistar.16mb.com/forum/jscripts/jquery.js?ver=1800"></script>
<script type="text/javascript" src="http://spedistar.16mb.com/forum/jscripts/jquery.plugins.min.js?ver=1800"></script>
<script type="text/javascript" src="http://spedistar.16mb.com/forum/jscripts/general.js?ver=1800"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script type="text/javascript">
    
if (typeof jQuery == 'undefined')
{
    document.write(unescape("%3Cscript src='images/majestic/js/j.js' type='text/javascript'%3E%3C/script%3E"));
}
</script>
<script type="text/javascript" src="images/majestic/js/maj.min.js"></script>
<script type="text/javascript" src="images/majestic/js/classie.js"></script>
<script type="text/javascript" src="images/majestic/js/tipsy.js"></script>
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/global.css" />
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/Postbit.css" />
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/css3.css" />
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/Majestic.css" />
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/Colors.css" />
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/Landing.css" />

<script type="text/javascript">
<!--
    lang.unknown_error = "Wystąpił nieznany błąd.";

    lang.select2_match = "Dostępny jest jeden wynik. Wciśnij enter, aby go wybrać.";
    lang.select2_matches = "Dostępnych wyników: {1}. Użyj strzałek w dół i w górę, aby nawigować.";
    lang.select2_nomatches = "Nic nie znaleziono";
    lang.select2_inputtooshort_single = "Wpisz co najmniej jeden znak";
    lang.select2_inputtooshort_plural = "Wpisz {1} lub więcej znaków";
    lang.select2_inputtoolong_single = "Usuń jeden znak";
    lang.select2_inputtoolong_plural = "Usuń {1} znaki/znaków";
    lang.select2_selectiontoobig_single = "Możesz wybrać tylko jednen wynik";
    lang.select2_selectiontoobig_plural = "Możesz wybrać tylko {1} wyniki/wyników";
    lang.select2_loadmore = "Wczytywanie większej ilości wyników";
    lang.select2_searching = "Wyszukiwanie";

    var cookieDomain = ".spedistar.16mb.com";
    var cookiePath = "/forum/";
    var cookiePrefix = "";
    var deleteevent_confirm = "Czy na pewno chcesz usunąć to wydarzenie?";
    var removeattach_confirm = "Czy na pewno chcesz usunąć zaznaczone załączniki?";
    var loading_text = 'Wczytywanie<br />Proszę czekać...';
    var saving_changes = 'Zapisywanie zmian...';
    var use_xmlhttprequest = "1";
    var my_post_key = "3adc8586a7430c0545fd3b0cf040c7be";
    var rootpath = "http://spedistar.16mb.com/forum";
    var imagepath = "http://spedistar.16mb.com/forum/images/majestic";
     var yes_confirm = "Tak";
    var no_confirm = "Nie";
    var MyBBEditor = null;
    var spinner_image = "http://spedistar.16mb.com/forum/images/majestic/spinner.gif";
    var spinner = "<img src='" + spinner_image +"' alt='' />";
// -->
</script>
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/global.css" />
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/Postbit.css" />
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/css3.css" />
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/Majestic.css" />
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/Colors.css" />
<link type="text/css" rel="stylesheet" href="http://spedistar.16mb.com/forum/cache/themes/theme19/Landing.css" />

<link rel="stylesheet" href="http://spedistar.16mb.com/forum/images/majestic/fonts/fa.css">
<link rel="alternate stylesheet" type="text/css" href="" title="red">
<link rel="alternate stylesheet" type="text/css" href="http://spedistar.16mb.com/forum/images/majestic/patterns/green.css" title="green">
<link rel="alternate stylesheet" type="text/css" href="http://spedistar.16mb.com/forum/images/majestic/patterns/blue.css" title="blue">
<link rel="alternate stylesheet" type="text/css" href="http://spedistar.16mb.com/forum/images/majestic/patterns/yellow.css" title="yellow">
<link rel="alternate stylesheet" type="text/css" href="http://spedistar.16mb.com/forum/images/majestic/patterns/orange.css" title="orange">
<link rel="alternate stylesheet" type="text/css" href="http://spedistar.16mb.com/forum/images/majestic/patterns/navy.css" title="navy">
<link rel="alternate stylesheet" type="text/css" href="http://spedistar.16mb.com/forum/images/majestic/patterns/purple.css" title="purple">
<link rel="alternate stylesheet" type="text/css" href="http://spedistar.16mb.com/forum/images/majestic/patterns/teal.css" title="teal">
<link rel="alternate stylesheet" type="text/css" href="http://spedistar.16mb.com/forum/images/majestic/patterns/brown.css" title="brown">
<link rel="alternate stylesheet" type="text/css" href="http://spedistar.16mb.com/forum/images/majestic/patterns/grey.css" title="grey">
<link rel="alternate stylesheet" type="text/css" href="http://spedistar.16mb.com/forum/images/majestic/patterns/pink.css" title="pink">
<link rel="alternate stylesheet" type="text/css" href="http://spedistar.16mb.com/forum/images/majestic/patterns/cement.css" title="cement">
<!-- end: headerinclude -->
</head>
    <body>

<form class="form-horizontal">
<fieldset>

<!-- Form Name -->
<legend><font color="white">Dodawanie trasy</font></legend>

<!-- Multiple Radios -->
<div class="form-group">
 <label class="col-md-4 control-label" for="typgry">Rodzaj gry:</label>
 <div class="col-md-4">
 <div class="radio">
   <label for="typgry-0">
     <input name="typgry" id="typgry-0" value="1" checked="checked" type="radio">
     Euro truck simulator 2
   </label>
    </div>
 <div class="radio">
   <label for="typgry-1">
     <input name="typgry" id="typgry-1" value="2" type="radio">
     American truck simulator
   </label>
    </div>
 </div>
</div>

<!-- Select Basic -->
<div class="form-group">
 <label class="col-md-4 control-label" for="miejscestartowe">Miejsce startowe:</label>
 <div class="col-md-4">
   <select id="miejscestartowe" name="miejscestartowe" class="form-control">
     <option value="1">Warszawa</option>
      <option value="2">Odense</option>
      <option value="3">Kraków</option>
   </select>
 </div>
</div>

<!-- Select Basic -->
<div class="form-group">
 <label class="col-md-4 control-label" for="miejscedocelowe">Miejsce docelowe:</label>
 <div class="col-md-4">
   <select id="miejscedocelowe" name="miejscedocelowe" class="form-control">
     <option value="1">Liepzig</option>
      <option value="2">Dortmund</option>
      <option value="3">Las vegas</option>
   </select>
 </div>
</div>

<!-- Text input-->
<div class="form-group">
 <label class="col-md-4 control-label" for="dystans">Dystans:</label>  
 <div class="col-md-4">
 <input id="dystans" name="dystans" placeholder="1561" class="form-control input-md" required="" type="text" pattern="[0-9]{,3}[\,|\.][0-9]{,1}">
 <span class="help-block">[km]</span>  
 </div>
</div>

<!-- Text input-->
<div class="form-group">
 <label class="col-md-4 control-label" for="paliwo">Zużyte paliwo:</label>  
 <div class="col-md-4">
 <input id="paliwo" name="paliwo" placeholder="519.2" class="form-control input-md" required="" type="text" pattern="[0-9]{,3}[\,|\.][0-9]{,1}">
 <span class="help-block">[litry]</span>  
 </div>
</div>

<!-- Text input-->
<div class="form-group">
 <label class="col-md-4 control-label" for="dochod">Dochód:</label>  
 <div class="col-md-4">
 <input id="dochod" name="dochod" placeholder="250719.00" class="form-control input-md" required="" type="text" pattern="[0-9]{,3}[\,|\.][0-9]{,1}">
 <span class="help-block">[euro]</span>  
 </div>
</div>

<!-- Text input-->
<div class="form-group">
 <label class="col-md-4 control-label" for="uszkodzenia">Uszkodzenia:</label>  
 <div class="col-md-4">
 <input id="uszkodzenia" name="uszkodzenia" placeholder="20%" class="form-control input-md" required="" type="text" pattern="[0-9]{,3}[\,|\.][0-9]{,1}">
 <span class="help-block">[%]</span>  
 </div>
</div>

<!-- Text input-->
<div class="form-group">
 <label class="col-md-4 control-label" for="konwoj">Konwój:</label>  
 <div class="col-md-4">
 <input id="konwoj" name="konwoj" placeholder="+1" class="form-control input-md" required="" type="text" pattern="[0-9]{,3}[\,|\.][0-9]{,1}">
   
 </div>
</div>

<!-- File Button -->
<div class="form-group">
 <label class="col-md-4 control-label" for="scr1">Screenshot #1:</label>
 <div class="col-md-4">
   <input id="scr1" name="scr1" class="input-file" type="file">
 </div>
</div>


<!-- File Button -->
<div class="form-group">
 <label class="col-md-4 control-label" for="scr2">Screenshot #2:</label>
 <div class="col-md-4">
   <input id="scr2" name="scr2" class="input-file" type="file">
 </div>
</div>

<!-- Textarea -->
<div class="form-group">
 <label class="col-md-4 control-label" for="notatka">Notatka:</label>
 <div class="col-md-4">                    
   <textarea class="form-control" id="notatka" name="notatka">Wiadomość dla dyspozytora</textarea>
 </div>
</div>

<!-- Button -->
<div class="form-group">
 <label class="col-md-4 control-label" for="dodajtrase"></label>
 <div class="col-md-4">
   <button id="dodajtrase" name="dodajtrase" class="btn btn-primary">Dodaj trasę</button>
 </div>
</div>

</fieldset>
</form>


<script type="text/javascript" src="assets/js/bootstrap.js"></script>
    </body>
    VTC stworzone przez <b>PolishBandit.</b> Kopiowanie i rozpowszechnianie zabronione.
    </br>
    System wirtualnego tachografu jest własnością firmy 'SpediStar'. ®
</html>

Tabelka w bazie danych:

DROP TABLE IF EXISTS `trasy`;
        
CREATE TABLE `trasy` (
 `id_trasy` INT NOT NULL AUTO_INCREMENT,
 `typ_gry` ENUM('1','2') NOT NULL DEFAULT '1',
 `start` ENUM('1','2','3') NOT NULL DEFAULT '1',
 `stop` ENUM('1','2','3') NOT NULL DEFAULT '1',
 `dystans` INT(10) NULL DEFAULT NULL,
 `paliwo` DECIMAL(4,1) NULL DEFAULT NULL,
 `zarobek` DECIMAL(10,2) NULL DEFAULT NULL,
 `uszkodzenia` TINYINT(3) NULL DEFAULT NULL,
 `konwoj` TINYINT(2) NULL DEFAULT NULL,
`screen_1` VARCHAR(128) NULL DEFAULT NULL,
`screen_2` VARCHAR(128) NULL DEFAULT NULL,
`notatka` VARCHAR(512) NULL DEFAULT NULL,
 `visible` ENUM('0','1') NOT NULL DEFAULT '0',
 PRIMARY KEY (`id_trasy`)
);

Ktoś, coś pomoże?
Ardex napisał 18.08.2016, 22:13:
Error 500. Wrzuć plik(i) jako załączniki
http://www.w3schools.com/php/php_mysql_insert.asp
http://www.w3schools.com/php/php_mysql_select.asp



Użytkownicy przeglądający ten wątek:

1 gości