PHP Mysql Insert only works in Chrome

-1

I have a page with a form where it is inserted name, project, etc ... only when I click on submit form in Firefox or IE does not work, but Chrome works normally.

NOTE:

1- I had an old bank. When I change to this old address the Insert works in both browsers.

2 - I have another page that updates the data and works normally for all browsers, the only problem is inserting data using IE and Firefox.

I am using a library for db php mysql: link

Would the problem be in the code, the bank, or the browser?

EDIT: Code:

function action_adddb () {
    global $db;

    $data = Array(
        'prname' => $_POST['prname'],
        'members' => $_POST['members']
    );

    $id = $db->insert ('users', $data);


    header ("Location: page_insert.php");
    exit;
}

$db = new Mysqlidb ('nomedohost', 'username', 'senha', 'nomedobanco');
if ($_GET) {
    $f = "action_".$_GET['action'];
    if (function_exists ($f)) {
        $f();
    }
}


<form name ="form1" class=" form-horizontal" action='page_insert.php?action=<?php echo $action?>' method=post>

<input type=hidden name='id' value='<?php echo $data['id']?>'>

<input class="form-control" type=text name='prname' required placeholder='Project Name' value="<?php echo $data['prname']?>">
<input class="form-control" type=text name='members' required placeholder='Members (First and Middle name)' value='<?php echo $data['members']?>'>
<input id="submit" name="submit" type="submit" value="Create"  class="btn btn-primary text-center btn-block">

</form>
    
asked by anonymous 26.05.2017 / 02:37

2 answers

0

Try using the code:

function action_adddb () {
    global $db;

    $data = Array(
        'prname' => $_POST['prname'],
        'members' => $_POST['members']
    );

    $id = $db->insert ('users', $data);


    header ("Location: page_insert.php");
    exit;
}

$db = new Mysqlidb ('nomedohost', 'username', 'senha', 'nomedobanco');
if (isset($_GET['action']) && !empty($_GET['action'])) {
    $f = "action_".trim($_GET['action']);
    if (function_exists ($f)) {
        $f();
    }
}


<form name ="form1" class=" form-horizontal" action='page_insert.php?action=<?php echo $action?>' method="post">

<input class="form-control" type="text" name='prname' placeholder='Project Name' value="<?php echo $data['prname']?>" required>
<input class="form-control" type="text" name='members' placeholder='Members (First and Middle name)' value='<?php echo $data['members']?>' required>

<input id="submit" name="submit" type="submit" value="Create" class="btn btn-primary text-center btn-block">

<input type=hidden name='id' value='<?php echo $data['id']?>'>

</form>

If it does not, say if it refreshes the page after clicking the Create button and if in the url it gets into the file page_insert.php with the query string ?action=nome_acao

    
26.05.2017 / 14:17
-1

I solved the problem, it was a date field (which I did not mention in the code above), I just took it out and it worked again

    
26.05.2017 / 22:21