PDA

View Full Version : forms can't be submitted?



roediej
12-10-2009, 02:12 PM
1) Script Title:
Ajax Tabs Content Script (v 2.2)
2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/
3) Describe problem:

ill try to explain it. I have a form on my website, that works without the ajax tabs. but when i fill the form in a ajax tabs contents webpage, it doens't work.

Examples:

With Ajax tabs content script (it won't work):
http://www.wirdumonline.nl/vier/ , klik right on the pencill en fill the form


without the script (and works!!)
http://www.wirdumonline.nl/vier/hoofdpagina.php , klik right on the pencill en fill the form

Here is the php code for the form:


<?
mysql_connect("localhost","***", "***")
or die("kan de MySQL server niet selecteren");
mysql_select_db("wirdum_wistjedat")
or die("kan de database niet selecteren");
if(isset($_POST['submit']) && isset($_POST['bericht']))
{

include('../include/functies.php');

$ip = $_SERVER['REMOTE_ADDR'];
$datum = date("d-m-Y");
$tijd = date("H:i:s");
$bericht = bbcode ($_POST['bericht']);
$naam = $_POST['naam'];
$query = mysql_query("SELECT * FROM wistjedat2 ORDER BY id DESC LIMIT 1") or die(mysql_error());
$result = mysql_fetch_object($query);

if($naam == "")
{
$error = "<b>Oops! Je naam is ook alweer?</b></br>";
}
elseif ($bericht == "")
{
$error = "<b>Oops! Je was je bericht vergeten.</b></br>";

}
else
{
$bericht = addslashes($bericht);
$query = mysql_query("INSERT INTO wistjedat2 VALUES ('','$bericht', '$ip', '$tijd', '$datum', '$naam')") or die(mysql_error());
echo "<meta http-equiv='refresh' content='0'; url='http://www.wirdumonline.nl/vier/' /> " ; /* Stuur de browser naar de PHP website */
exit; /* Zorg dat de code hieronder niet wordt uitgevoerd */
}
}
?>

<?
if(isset($error))
{
echo $error;
}

?>

<h4><img src="img/pencil_add.png" alt="Show Div" style="cursor:pointer;" onclick="showContent(this);"></h4>

<div style="margin-top:0px; display:none;">
<form method="post" name="wistjedat" >
<input name="submit" type="hidden" value="submit">
<strong> Wist je dat..</strong><br>
<input name="bericht" type="text" value="" size="35" maxlength="120">
[BBcode is AAN]
<br>
<br>
Smilies:
<br>
<a name='plaatsen'></a><img style="margin: 1px; margin-left: 0px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ':)')" src="images/smilies/smile.gif" alt="Emoticon"> <img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ':D')" src="images/smilies/biggrin.gif" alt="Emoticon"> <img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ':p')" src="images/smilies/tongue.gif" alt="Emoticon"> <img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ':(')" src="images/smilies/sad.gif" alt="Emoticon"> <img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ';)')" src="images/smilies/wink.gif" alt="Emoticon"> <img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ':angry')" src="images/smilies/angry.gif" alt="Emoticon"> <img style="margin: 1px; margin-left: 0px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ':roll')" src="images/smilies/rolleyes.gif" alt="Emoticon"> <img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ':kiss')" src="images/smilies/kiss.gif" alt="Emoticon"> <img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ':cool')" src="images/smilies/cool.gif" alt="Emoticon"> <img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ':cry')" src="images/smilies/cry.gif" alt="Emoticon"> <img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ':huh')" src="images/smilies/huh.gif" alt="Emoticon"> <img style="margin: 1px" onMouseover="this.style.cursor='pointer'" onClick="sendtext(document.wistjedat.bericht, ':omg')" src="images/smilies/omg.gif" alt="Emoticon"><br>
Naam:<br>
<input name="naam" type="text" value="" size="9" maxlength="5">
<br>
<br>
<input name="submit2" type="submit" value="Plaats">
</form>

i really don't understand it :( someone can help me ?

jscheuer1
12-10-2009, 04:58 PM
Well I can't quite see what is happening. I can say that any javascript on a page imported via AJAX will not run. And that if your form's HTML is invalid, it might work without AJAX but then get messed up when imported via AJAX.

My advice, if it works without AJAX, use it without AJAX. After all, you have a PHP enabled server, you may include the form on the page via PHP.

roediej
12-10-2009, 07:10 PM
thanks, i will do it without the ajax tabs then. Im getting tired when forms and other php stuff didn't work.

Now it works without ajax and with include php.

thanks!