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
bla5e
Forum Contributor
Posts: 234 Joined: Tue May 25, 2004 4:28 pm
Post
by bla5e » Mon Jul 12, 2010 11:49 am
Code: Select all
<select name="prods[]" id="products" MULTIPLE size=5 style="width:250px; display:none;">
</select>
<select name="cats[]" id="categories" MULTIPLE>
{foreach from=$categories item=category}
<option value="{$category.id}">{$category.category}</option>
{foreachelse}
<optgroup label="[SQL ERROR]"></optgroup>
{/foreach}
</select>
<script type="text/javascript">
$('#products').load('https://corp.my.domain/associatedpubs/');
</script>
It loads the select boxes fine.
Code: Select all
if(is_array($_POST['prods'])){
echo '<script type="text/javascript">alert(\'Product Array!\');</script>';
}
if (is_array($_POST['cats'])){
echo '<script type="text/javascript">alert(\'Category Array!\');</script>';
}
I never see the alerts
I have DB delete/inserts inside the same IF;s but neither of them get hit either.
When i do
print_r($_POST['cats']);
print_r($_POST['prods']);
it just says ArrayArray.
wtf?
Jade
Forum Regular
Posts: 908 Joined: Sun Dec 29, 2002 5:40 pm
Location: VA
Post
by Jade » Mon Jul 12, 2010 12:09 pm
Have you viewed your source to see if it's printing the javascript on the page?
bla5e
Forum Contributor
Posts: 234 Joined: Tue May 25, 2004 4:28 pm
Post
by bla5e » Mon Jul 12, 2010 1:00 pm
Jade wrote: Have you viewed your source to see if it's printing the javascript on the page?
its not
bla5e
Forum Contributor
Posts: 234 Joined: Tue May 25, 2004 4:28 pm
Post
by bla5e » Mon Jul 12, 2010 1:23 pm
i forgot about my sql injection script to stop from injections
this fix
Code: Select all
foreach($_POST as $key=>$value) {
if($key != 'prods' && $key != 'cats'){
$_POST[$key] = pg_escape_string(stripslashes($value));
}
}
Jade
Forum Regular
Posts: 908 Joined: Sun Dec 29, 2002 5:40 pm
Location: VA
Post
by Jade » Mon Jul 12, 2010 2:00 pm
It sounds to me like it's not posting any of your form values.
AbraCadaver
DevNet Master
Posts: 2572 Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:
Post
by AbraCadaver » Mon Jul 12, 2010 2:08 pm
You've done something else in your code that is creating a multi-dimensional array out of those. Post your code from the entire page.
mysql_function(): WARNING : This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.