php compatibility

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
reverend_ink
Forum Contributor
Posts: 151
Joined: Sun Apr 20, 2003 1:18 am
Location: Las Vegas | London

php compatibility

Post by reverend_ink »

I am working on a script

Code: Select all

<?php
if ($submit){

@mysql_connect($host, $loginname, $password) or die(mysql_error()); 
@mysql_select_db($data) or die('Could not select database'.mysql_error()); 

$id = mysql_insert_id();

$lsql = "INSERT INTO $table 
VALUES ( '$id' , '$sec' , '$user' , '$pass' , '$post')";

mysql_query($lsql);

echo "<br>!!USER ADDED!!";

}

?>
And in IE it posts fine to mysql, but in mozilla and firebird it doesn't...

What is happening? I have never seen this before... am I missing something?
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

PHP is serverside and so it doesnt matter what browser your using. Dont know what could be happening.
reverend_ink
Forum Contributor
Posts: 151
Joined: Sun Apr 20, 2003 1:18 am
Location: Las Vegas | London

Post by reverend_ink »

Its the wierdest thing... I didnt think it was possible but sure enough, there is it... nothing....
redmonkey
Forum Regular
Posts: 836
Joined: Thu Dec 18, 2003 3:58 pm

Post by redmonkey »

Mozzila based browsers do not pass the value of the form submit unless the submit button is physically clicked on. So I would guess that you are filling in your form and pressing return/enter and not clicking the submit button?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Might be a plan to check for the existance of a hidden field rather than the submit button, since, as redmonkey indicated, there are browser inconsistencies. Also ensure that you use isset() (or empty() depending on need) to check whether a variable is set rather than doing $submit or !$submit which should only be used to check for true or false values.

Mac
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

redmonkey wrote:Mozzila based browsers do not pass the value of the form submit unless the submit button is physically clicked on. So I would guess that you are filling in your form and pressing return/enter and not clicking the submit button?
That's odd, I just coded up a little test and it did the opposite for me.
User avatar
werlop
Forum Commoner
Posts: 68
Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null

Post by werlop »

Hey, this is nothing to do with your problem, but it looks like you've got register globals on (you proably know this already, as you would have to have turned it on). This really should be off, as it promotes sloppy coding.
Post Reply