<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Форум PHP-MyAdmin.RU &mdash; Проблемы с чекбоксами]]></title>
	<link rel="self" href="https://forum.php-myadmin.ru/extern.php?action=feed&amp;tid=3326&amp;type=atom" />
	<updated>2014-06-04T11:28:39Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.php-myadmin.ru/viewtopic.php?id=3326</id>
		<entry>
			<title type="html"><![CDATA[Re: Проблемы с чекбоксами]]></title>
			<link rel="alternate" href="https://forum.php-myadmin.ru/viewtopic.php?pid=24860#p24860" />
			<content type="html"><![CDATA[<p>Посмотрите как выглядят запросы вида: $query_sel = &quot;select * from GLAVA where ID_GLAV=$_POST[thema]&quot;;<br />Попробуйте их выполнить в phpMyAdmin. При наличии ошибки, исправьте ее.</p><p>Прервать выполнение скрипта и вывести запрос можно строкой:<br /></p><div class="codebox"><pre><code>exit($query_sel);</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Hanut]]></name>
				<uri>https://forum.php-myadmin.ru/profile.php?id=181</uri>
			</author>
			<updated>2014-06-04T11:28:39Z</updated>
			<id>https://forum.php-myadmin.ru/viewtopic.php?pid=24860#p24860</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Проблемы с чекбоксами]]></title>
			<link rel="alternate" href="https://forum.php-myadmin.ru/viewtopic.php?pid=24859#p24859" />
			<content type="html"><![CDATA[<p>Я новичек в php, перерыла кучу форумов, но так и не разобралась. <br />Проблема такая: есть страница с чекбоксами, значения id_fk&nbsp; должны считываться с базы(все ок), а если изменяются, то соответственно перезаписываться в базу по выбранной&nbsp; id_glav - здесь проблема.</p><p>Вот код:</p><p>&lt;form name=&quot;edit_fk&quot; action=&quot;edit_fk_su.php&quot; method=&quot;post&quot; target=&quot;main&quot;&gt;<br />&lt;?php</p><p>if ($_POST[&#039;kaf&#039;] &amp;&amp; $_POST[&#039;thema&#039;])</p><p>$basename=$_POST[&#039;kaf&#039;];<br />$id_thema= $_POST[&#039;thema&#039;];<br />$id_fk=$_POST[&#039;fk&#039;];<br />include &quot;config.php&quot;;</p><p>echo &#039;&lt;br&gt;&#039;;<br />$quer = &quot;select * from DISCIPLINE where DISC = $_POST[discip] order by DISC&quot;;<br />&nbsp; &nbsp; $res4 = mysql_query($quer);<br />&nbsp; &nbsp; list($DISC, $D_NASME)=mysql_fetch_row($res4);<br />&nbsp; &nbsp; echo &quot;&lt;p&gt;&amp;nbsp; Дисциплина:&amp;nbsp;&amp;nbsp;&quot;;<br />&nbsp; &nbsp; echo &quot;&lt;input type=text name=D_NASME size=100 value=\&quot;&quot;.$D_NASME.&quot;\&quot;&gt;&quot;;<br />&nbsp; &nbsp; echo &#039;&lt;br&gt;&#039;;<br />echo &#039;&lt;br&gt;&#039;;<br />&nbsp; &nbsp; echo &quot;&amp;nbsp; Тема:&amp;nbsp;&amp;nbsp;&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $query_sel = &quot;select * from GLAVA where ID_GLAV=$_POST[thema]&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $res_sel = mysql_query($query_sel);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; list($id_glav, $id_disc, $N_glav, $GL_NAME)=@mysql_fetch_row($res_sel);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &quot;&lt;input type=text name=thema size=100 value=\&quot;&quot;.$GL_NAME.&quot;\&quot;&gt;&quot;;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; echo &#039;&lt;br&gt;&#039;;<br />echo &#039;&lt;br&gt;&#039;;</p><p>$select=mysql_query(&quot;select * from active_fk WHERE ID_GLAV=&quot;.(int)$id_thema.&quot;;&quot;);&nbsp; <br />&nbsp; if(mysql_num_rows($select))while($mass=mysql_fetch_array($select)){ <br />&nbsp; &nbsp; $active[$mass[&#039;ID_FK&#039;]]=1;<br />&nbsp; }<br />$select=mysql_query(&quot;select * from form_kont&quot; ); <br />&nbsp; while($mass=mysql_fetch_array($select)){ <br />&nbsp; &nbsp; &nbsp;echo &quot;&lt;label&gt;&quot;.$mass[NAZV_FK].&quot;&lt;/label&gt;&quot;;&nbsp; <br />&nbsp; &nbsp; echo &quot;&lt;input name=&#039;check[&quot;.$mass[ID_FK].&quot;]&#039; type=&#039;checkbox&#039; value=&#039;1&#039;&quot;; <br />&nbsp; &nbsp;// echo &quot;&lt;input name=&#039;check[&quot;.$mass[ID_FK].&quot;]&#039; type=&#039;hidden&#039; value=&#039;1&#039;&quot;; <br />&nbsp; &nbsp;&nbsp; if($active[$mass[&#039;ID_FK&#039;]])echo(&#039;checked=&quot;checked&quot;&#039;);<br />&nbsp; &nbsp;&nbsp; echo &quot;/&gt;&lt;br&gt;&quot;;&nbsp; //все ок-значения считывает<br />&nbsp; &nbsp;} <br />&nbsp; &nbsp;echo &quot;&lt;br&gt;&quot;; </p><p>if(isset($_POST[$active[$mass[&#039;ID_FK&#039;]]]) &amp;&amp; strlen($checkbox[1])&gt; 0)<br />{ <br />&nbsp; &nbsp; $active[$mass[&#039;ID_FK&#039;]]=1;<br />&nbsp; } <br />//проблема здесь</p><br /><p>echo &quot;&lt;input type=hidden name=kaf value=\&quot;&quot;.$_POST[&#039;kaf&#039;].&quot;\&quot;&gt;&quot;;<br />echo &quot;&lt;input type=hidden name=discip value=\&quot;&quot;.$_POST[&#039;discip&#039;].&quot;\&quot;&gt;&quot;;<br />echo &quot;&lt;input type=hidden name=thema value=\&quot;&quot;.$_POST[&#039;thema&#039;].&quot;\&quot;&gt;&quot;;<br />echo &quot;&lt;input type=hidden name=fk value=\&quot;&quot;.$_POST[&#039;fk&#039;].&quot;\&quot;&gt;&quot;;<br />echo &#039;&lt;input name=&quot;insert&quot; type=&quot;submit&quot; value=&quot;Добавить&quot; align=&quot;center&quot;&gt;&#039;;</p><p>?&gt;<br />&lt;/form&gt;</p>]]></content>
			<author>
				<name><![CDATA[keytea]]></name>
				<uri>https://forum.php-myadmin.ru/profile.php?id=6018</uri>
			</author>
			<updated>2014-06-04T10:25:46Z</updated>
			<id>https://forum.php-myadmin.ru/viewtopic.php?pid=24859#p24859</id>
		</entry>
</feed>
