I have a registration form that I’m working on and it’s turning out to be a pain.
I’m very new to PHP, so please cut me some slack – haha.
I installed a jQuery plugin that allowed me to make inline labels for my textboxes. I also created an error box for any errors that occur during the registration process (invalid email, etc.). Here’s some of my HTML/PHP code.
<?php
if($_POST['submit'])
{
$signuperror = "Hello World";
?>
<?php if($signuperror != "") { ?>
<span id="signuperror"><?= $signuperror; ?></span>
<?php } ?>
The problem was that the “error” of “Hello World” was not displaying when I clicked the submit button on my form. I copied and pasted this code onto a test.php document and it worked fine. So I knew that it had to be from my other html code. After troubleshooting almost every line of code, I found the culprit. It turns out that the jQuery plugin initialization for the inline labels was the problem.
$(function(){
$.fn.formLabels();
$("form").submit(function(){
var formVal = $("form").serialize();
parent.$("#default div.results").html(formVal);
return false
})
});
When I deleted this, it worked just fine (without my inline labels, of course).
What could I do to make BOTH the PHP and jQuery work.
Thanks.
– Ryan
There are lot of things here that are going on. Need to do this step by step.
<?phpformat or use<?short form but to be sure i would code all in<?phpso its compatible everywhere<?php echo $variable; ?>rather than<?=. Not that its no good or so but it will take out any php config issues with asp style output.Jquery is not messing with your PHP. That title is just as random as my answer.