...

View Full Version : Resolved PHP and MySQL, Submit not working in Firefox(?)



Tuxxy87
03-08-2010, 09:54 PM
I have a rather weird problem, and my google-fu seems to be weak at the moment.

We've made a little script that simply sends the data in some form fields to a database, all is well when data is sent with either Opera and Internet Explorer, data is accepted and can be fetched, but in Firefox and Chrome, it won't send any data at all. Does anyone see the problem here?

The INSERT script.



<?php
$myServer = "SOMESERVER";
$myUser = "USER";
$myPass = "PASS";
$myDB = "DATABASE";
//henter data fra input-skjema
$gbEier = $_POST['gbEier'];
$gbDato = $_POST['gbDato'];
$gbGjestNavn = $_POST['gbGjestNavn'];
$gbMelding = $_POST['gbMelding'];


$dbhandle = mysql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");


$selected = mysql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");


$sqltxt = "INSERT INTO gjestebok(gbEier, gbDato, gbGjestNavn, gbMelding) VALUES('$gbEier', '$gbDato', '$gbGjestNavn', '$gbMelding')";



$result = mysql_query($sqltxt) or die("2Couldn't open database $myDB");

//stenger av etter at jobben er gjordt
mysql_close($dbhandle);
echo "It's sent!";
?>




The SELECT script.




<div class="hent">
<?php
$myServer = "hera.hint.no";
$myUser = "mmt106";
$myPass = "gDIPry1";
$myDB = "mmt106";

//connects to the server
$dbhandle = mysql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");

//selects a database
$selected = mysql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");


$resultat = mysql_query("SELECT * FROM gjestebok WHERE gbEier='050818'") or die("Feil nummer 0 " . mysql_error()) ;


$num = mysql_num_rows($resultat) or die("Feil nummer 1 " . mysql_error()) ; //skriver ut en fancy overskrift
echo "<h2>" . $num . " Rad" . ($num == 1 ? "" : "er") . " ble returnert. </h2>";
echo "<hr size='3' color='#990000'>";


while ($row = mysql_fetch_array($resultat)) {
$dato=$row[gbDato];
$eier=$row[gbEier];
$navn=$row[gbGjestNavn];
$melding=$row[gbMelding];
?>
<table class="tabell" border="0" cellpadding="1" cellspacing="30" >
<tr><td><?php echo $dato; ?></td>
<td ><?php echo $eier; ?></td>
<td ><?php echo $navn; ?></td>
<td ><?php echo $melding; ?></td></tr>
</table>
<?php

}


mysql_close($dbhandle);
?>
</div>





And finally, the webpage that contains the submit boxes.


<form action="hera.php" method="POST">
<table class="skjema">
<tr>

<td></td><td><input id="gbEier" type="text" name="gbEier" value="050818" /></td>
</tr>
<tr>

<td><p>Dato:</p> </td><td><input id="gbDato" type="text" name="gbDato" value="" /></td>
</tr>
<tr>

<td><P>Navn:</p> </td><td><input id="gbGjestNavn" type="text" name="gbGjestNavn" value="BLANK" /></td>
</tr>
<tr>

<td><p>Melding:</p> </td><td><textarea id="gbMelding" name="gbMelding" cols="72" rows="2"></textarea></td>
</tr>

<tr>
<td colspan="2"><a href="BLANK"><input class="reg" type="submit" name="submit" value="Registrer" /></a>&nbsp;<input class="tom" type="reset" name="reset" value="TÝm skjema" />
</tr>
</table>
</form>

<form class="les" action="BLANK" method="POST">
Les melding:&nbsp; &nbsp;<td colspan="2"><input class="melding" type="submit" name="submit" value=" X " /></form></td>

angst
03-08-2010, 10:11 PM
the submit button needs to be inside of the close form element, ie: </form>

Tuxxy87
03-09-2010, 09:50 AM
Ah yes of course, how did I miss that..?

Thank you!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum