Jump to content
php.lv forumi

Kaut kas līdzīgs anketai


krisis32

Recommended Posts

Sveiki visi! Varbūt kādam kaut kur ir aizķēries, vai arī būtu tik labs un varētu izveidot tādu kā skriptu.

Ko skripts darīs? Būs tāda, kā anketa.

 

NIKS:

SKYPE:

KOMANDA(drop down lists ar komandām):

 

(tās komandas kuras jau ir aizsūtītas ar SUBMIT pogu vairāk drop down sarakstā neparādas)

Tad uzspiež pogu SŪTĪT/SUBMIT un infa nonāk DB noteiktā tabulā un tad NIKS/SKYPE/KOMANDA tike izvadīta lapā noteiktajā vietā! Var arī izveidot līdz tam ka infa nonāk DB. Tālāk pats centīšos izgudrot!

 

Paldies jau iepriekš.

Edited by krisis32
Link to comment
Share on other sites

DB

CREATE TABLE IF NOT EXISTS `tabula` (
 `id` int(11) NOT NULL auto_increment,
 `niks` varchar(255) collate utf8_unicode_ci NOT NULL,
 `skype` varchar(255) collate utf8_unicode_ci NOT NULL,
 `komanda` varchar(255) collate utf8_unicode_ci NOT NULL,
 PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=3 ;

index.php

<?
if($_POST['add']){
if($_POST['niks'] || $_POST['skype'] != ""){
$niks = mysql_real_escape_string($_POST['niks']);
$skype = mysql_real_escape_string($_POST['skype']);
$team = mysql_real_escape_string($_POST['team']);
mysql_query("INSERT INTO tabula(niks, skype, komanda) VALUES('$niks', '$skype', '$team')") or die(mysql_error());
echo"ok";
}else{echo"aizpildi visus laukus";}
}
?>
<form method="post">
Niks <input name='niks' type='text'><br/>
Skype <input name='skype' type='text'><br/>
Komanda <select name='team'>
<option value='komanda1'>Komanda1</option>
<option value='komanda2'>Komanda2</option>
</select>
<input name='add' type='submit'>

Edited by chizijs
Link to comment
Share on other sites

tu skriptā izveidoji konekciju ar DB?

sākumā ieliec:

 

$db_host = 'localhost';
$db_user = 'user';
$db_password = 'parole';
$db_name = 'datubaaze';

$connection = mysql_connect($db_host, $db_user, $db_password) or die(mysql_error());
mysql_select_db($db_name, $connection);
mysql_query("SET NAMES utf8");

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...