HTML form name arrays ie square bracket names

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kumard
Forum Newbie
Posts: 5
Joined: Thu Jul 15, 2010 1:32 pm

HTML form name arrays ie square bracket names

Post by kumard »

I've been building a form with several related select fields. The names are agent_id[].

On my Dev server they work fine and populate the PHP global variables correctly (eg $_POST, $_REQUEST). On the Production server they don't populate the variables at all.

Here's the Dev server: http://www.tech-development.net/cal_tours/DEV/test.php (PHP Version 5.2.9)

Here's the Production server: https://74.208.172.205:8443/sitepreview ... m/test.php (PHP Version 5.1.6)

Exact same code but different results.

I think that there are some settings issues but wanted to know if anyone else has had this issue and how to fix it.

Thanks for your help.

K
Bind
Forum Contributor
Posts: 102
Joined: Wed Feb 03, 2010 1:22 am

Re: HTML form name arrays ie square bracket names

Post by Bind »

no idea since you have not posted any source code, but off the top of my head maybe one server has register globals on and the other has them off - if you are depending on register globals. I always code without using register globals as they can be a security risk.
kumard
Forum Newbie
Posts: 5
Joined: Thu Jul 15, 2010 1:32 pm

Re: HTML form name arrays ie square bracket names

Post by kumard »

<form action="testresult.php" method="post">
<table cellpadding="0" cellspacing="0" class="tour_content_text" border="1">
<tr>
<td><div class="field">
<select name="agent_id[]">
<option>Select</option>
<option value="70" selected>BERKELEY CVB</option>
<option value="150">BILL KIM'S PRIVATE CLIENT</option>
<option value="81">BK'S DIRECT CHARTER CLIENT</option>
<option value="18">BRANDON COLLEGE</option>
<option value="68">BROADVISION</option>
</select>
</div></td>
</tr>
<tr>
<td><div class="field">
<select name="agent_id[]">
<option>Select</option>
<option value="70">BERKELEY CVB</option>
<option value="150" selected>BILL KIM'S PRIVATE CLIENT</option>
<option value="81">BK'S DIRECT CHARTER CLIENT</option>
<option value="18">BRANDON COLLEGE</option>
<option value="68">BROADVISION</option>
</select>
</div></td>
</tr>
<tr>
<td><div class="field">
<select name="agent_id[]">
<option>Select</option>
<option value="70">BERKELEY CVB</option>
<option value="150">BILL KIM'S PRIVATE CLIENT</option>
<option value="81" selected>BK'S DIRECT CHARTER CLIENT</option>
<option value="18">BRANDON COLLEGE</option>
<option value="68">BROADVISION</option>
</select>
</div></td>
</tr>
<tr>
<td><div class="field">
<select name="agent_id[]">
<option>Select</option>
<option value="70">BERKELEY CVB</option>
<option value="150">BILL KIM'S PRIVATE CLIENT</option>
<option value="81">BK'S DIRECT CHARTER CLIENT</option>
<option value="18" selected>BRANDON COLLEGE</option>
<option value="68">BROADVISION</option>
</select>
</div></td>
</tr>
</table>
<input type="submit"></form>
Bind
Forum Contributor
Posts: 102
Joined: Wed Feb 03, 2010 1:22 am

Re: HTML form name arrays ie square bracket names

Post by Bind »

that is your form html

we need to view 'testresult.php' and any required/include files contained therein.
kumard
Forum Newbie
Posts: 5
Joined: Thu Jul 15, 2010 1:32 pm

Re: HTML form name arrays ie square bracket names

Post by kumard »

Here you go. I'm printing out the contents of the array.
<?php
print_r ($_REQUEST);
?>
kumard
Forum Newbie
Posts: 5
Joined: Thu Jul 15, 2010 1:32 pm

Re: HTML form name arrays ie square bracket names

Post by kumard »

Oh and here's the settings from phpinfo

Directive Local Value Master Value
allow_call_time_pass_reference Off Off
allow_url_fopen On On
always_populate_raw_post_data Off Off
arg_separator.input & &
arg_separator.output & &
asp_tags Off Off
auto_append_file no value no value
auto_globals_jit On On
auto_prepend_file no value no value
browscap no value no value
default_charset no value no value
default_mimetype text/html text/html
define_syslog_variables Off Off
disable_classes no value no value
disable_functions no value no value
display_errors Off Off
display_startup_errors Off Off
doc_root no value no value
docref_ext no value no value
docref_root no value no value
enable_dl On On
error_append_string no value no value
error_log no value no value
error_prepend_string no value no value
error_reporting 2047 2047
expose_php On On
extension_dir /usr/lib64/php/modules /usr/lib64/php/modules
file_uploads On On
highlight.bg #FFFFFF #FFFFFF
highlight.comment #FF8000 #FF8000
highlight.default #0000BB #0000BB
highlight.html #000000 #000000
highlight.keyword #007700 #007700
highlight.string #DD0000 #DD0000
html_errors On On
ignore_repeated_errors Off Off
ignore_repeated_source Off Off
ignore_user_abort Off Off
implicit_flush Off Off
include_path .: .:
log_errors On On
log_errors_max_len 1024 1024
magic_quotes_gpc Off Off
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
mail.force_extra_parameters no value no value
max_execution_time 30 30
max_input_nesting_level 64 64
max_input_time 60 60
memory_limit 32M 32M
output_buffering 4096 4096
output_handler no value no value
post_max_size 8M 8M
precision 14 14
realpath_cache_size 16K 16K
realpath_cache_ttl 120 120
register_argc_argv Off Off
register_globals Off Off
register_long_arrays Off Off
report_memleaks On On
report_zend_debug On On
safe_mode On On
safe_mode_exec_dir no value no value
safe_mode_gid Off Off
safe_mode_include_dir no value no value
sendmail_from no value no value
sendmail_path /usr/sbin/sendmail -t -i /usr/sbin/sendmail -t -i
serialize_precision 100 100
short_open_tag On On
SMTP localhost localhost
smtp_port 25 25
sql.safe_mode Off Off
track_errors Off Off
unserialize_callback_func no value no value
upload_max_filesize 2M 2M
upload_tmp_dir no value no value
user_dir no value no value
variables_order EGPCS EGPCS
xmlrpc_error_number 0 0
xmlrpc_errors Off Off
y2k_compliance On On
zend.ze1_compatibility_mode Off Off
kumard
Forum Newbie
Posts: 5
Joined: Thu Jul 15, 2010 1:32 pm

Re: HTML form name arrays ie square bracket names

Post by kumard »

No one has any idea. sigh....
Post Reply