Jump to content
php.lv forumi

input iekš mysql db


Puika1

Recommended Posts

es uztaisiju input ar checkbox kas pievieno atzimetos datus datubāzē,bet problēma radās ar to,ja ir divi checkbox logi,ja atzīmē abus,tad pievienojas datubāzē,bet ja tikai vienu nekā ;( kā var,lai pēc izvēles atzīmētu un pievienotu datubāzē?

 

KODS

 

if($_POST['add']){
if($_POST['twitter'] && $_POST['kontakti']){
$twitter = mysql_real_escape_string($_POST['twitter']);
$kontakti = mysql_real_escape_string($_POST['kontakti']);
mysql_query("INSERT INTO `pasutit`(`twitter`,`kontakti`) VALUES('$twitter','$kontakti')");

Edited by Puika1
Link to comment
Share on other sites

Ja tu domāji "Noklusēts" tad man jau ir.

 

`twitter` varchar(225) collate utf8_latvian_ci NOT NULL default 'Nē',

`kontakti` varchar(225) collate utf8_latvian_ci NOT NULL default 'Nē',

 

Vaj arī tu domāji kautko saistītu ar input formu

 

<input type="checkbox" name="twitter" value="Jā" />

 

Šitā ar mēģināju,nekā!

 

<input type="hidden" name="twitter" value="0" /> <input type="checkbox" name="twitter" value="Jā" />

Edited by Puika1
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...