Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > pl.comp.lang.php > #15190

nie POSTuje się jeden checkbox

From Jivanmukta <jivanmukta@poczta.onet.pl>
Newsgroups pl.comp.lang.php
Subject nie POSTuje się jeden checkbox
Date 2016-07-21 18:41 +0200
Organization Aioe.org NNTP Server
Message-ID <nmqtvm$13o7$1@gioia.aioe.org> (permalink)

Show all headers | View raw


Nie POSTuje mi się jeden checkbox na formularzu. Inne checkboxy zdefiniowane 
podobnie się POSTują. Inne pola też.
Mam w PHP:

...
<?php
echo form_open_multipart(empty($fullAnnouncementNo) ? 'announcement/insert' 
: 'announcement/update', 
			 array('id' => 'announcement', 'name' => 
'announcement'));
?>
<div>
<input id="referer_page" name="referer_page" type="hidden" value="<?php if 
(empty($fullAnnouncementNo) && array_key_exists('HTTP_REFERER', $_SERVER)) 
echo $_SERVER['HTTP_REFERER']; ?>">
<input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $maxFileSize; 
?>">
</div>
...
<fieldset id="property_data">
...
<div id="property_house_field">
<div class="label"><label for="property_house">Domek 
letniskowy:</label></div>
<div class="control">
<input type="checkbox" id="property_house" name="property_house" <?php echo 
myChecked('property_house', $field_values); ?>>
</div>
</div>
<div id="property_buildings_field">
<div class="label"><label 
for="property_buildings">Zabudowania:</label></div>
<div class="control">
<input type="checkbox" id="property_buildings" name="property_buildings" 
<?php echo myChecked('property_buildings', $field_values); ?>>
</div>
</div>
...

co daje kod HTML:

...
<form action="http://localhost/~robert/announcement/insert" method="post" 
accept-charset="utf-8" id="announcement" name="announcement" 
enctype="multipart/form-data">
<div>
<input id="referer_page" name="referer_page" type="hidden" value="">
<input type="hidden" name="MAX_FILE_SIZE" value="10485760">
</div>
...
<fieldset id="property_data">
...
<div id="property_house_field">
<div class="label"><label for="property_house">Domek 
letniskowy:</label></div>
<div class="control">
<input type="checkbox" id="property_house" name="property_house" >
</div>
</div>
<div id="property_buildings_field">
<div class="label"><label 
for="property_buildings">Zabudowania:</label></div>
<div class="control">
<input type="checkbox" id="property_buildings" name="property_buildings" >
</div>
</div>
...

Po zaznaczeniu checkbox property_buildings się POSTuje, natomiast po 
zaznaczeniu property_house nie. Tzn. nie ma go ani w $this->input->post ani 
w $_POST ani w file://input.
Po wywołaniu akcji kontrolera Announcement:

public function insert() {
$raw_post = file_get_contents('php://input');
echo 'insert() input:';var_dump($raw_post['property_house']);
$this->afterSubmit('insert');
}

mam:

insert() input:
A PHP Error was encountered
Severity: Warning
Message: Illegal string offset 'property_house'
Filename: controllers/announcement.php
Line Number: 263
A PHP Error was encountered
Severity: Notice
Message: Uninitialized string offset: 0
Filename: controllers/announcement.php
Line Number: 263
string '' (length=0)
afterSubmit() post:
string '' (length=0)

Nie chodzi o limit <input type="hidden" name="MAX_FILE_SIZE" 
value="10485760">. Ten limit jest wystarczający.

Używam PHP Version 5.5.9-1ubuntu4.13 Linux pecet 3.13.0-37-generic #64-
Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64. Pracuję na localhoście.
Nie wiem co robię źle. Proszę o pomoc.

Back to pl.comp.lang.php | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

nie POSTuje się jeden checkbox Jivanmukta <jivanmukta@poczta.onet.pl> - 2016-07-21 18:41 +0200
  Re: nie POSTuje się jeden checkbox ww <ww@o2.pl> - 2016-07-22 08:12 +0200
    Re: nie POSTuje się jeden checkbox Jivanmukta <jivanmukta@poczta.onet.pl> - 2016-07-22 09:25 +0200
  nie POSTuje się jeden checkbox Rafal Podsiadly <spinacz24@gmail.com> - 2016-07-22 08:03 -0700
    Re: nie POSTuje się jeden checkbox Jivanmukta <jivanmukta@poczta.onet.pl> - 2016-07-22 18:32 +0200

csiph-web