Jump to content

[SOLVED] Sessions and validation


NottaGuru

Recommended Posts

Here is the problem...

 

I a using a form with and when I go to validate the page at w3.org, I keep getting an error. Here is the error message...

 

Line 143, Column 130: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag .

…="2220e2191459ffd5fe7147301a0cdd77" />

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

 

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

 

And the error code...

 

<form id='ContactForm' action=' ' method='post'><input type="hidden" name="PHPSESSID" value="2220e2191459ffd5fe7147301a0cdd77" />

 

The actual code is...

 

		echo("$ErrorMessage
	</div>
	");
}
?>

	<form id='ContactForm' action='<?php $PHP_SELF ?>' method='post'>
	<table id='DepartmentTable' cellpadding='0' cellspacing='0' width='600px' border='0'>
		<tr>

 

I noticed that on the validation code that my links are...

<a href='../sitemap.php?PHPSESSID=6ee20bfa4b9389075a31651e6d521588'>Site Map</a>

 

I used

ini_set('session.use_trans_sid', false);

to get rid of the session showing up in the address bar and it appears to work, but I can't get the error in my form to go away. I have tried echo-ing the form tag, changing the $PHP_SELF to contactus.php, putting the form inside the table. I am at a total loss here.....

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/70078-solved-sessions-and-validation/
Share on other sites

because your php code isn't valid

saying $PHP_SELF (Fyi that isn't a super global variable, you must define this the variable for the page it self is $_SERVER['self'])

you have to echo something try this

 

<?php echo $_SERVER['self'];?>

 

instead of that php_self

I'm not putting the

input type='hidden'

in my coding. Here is the code I am using...

 

<form id='ContactForm' action='<?php echo $_SERVER['self'];?>' method='post'>
<table id='DepartmentTable' cellpadding='0' cellspacing='0' width='600px' border='0'>

 

And here is what the validator is showing...

 

<form id='ContactForm' action='' method='post'><input type="hidden" name="PHPSESSID" value="ebbf15bd11e6164cf92410d80ee371b9" /> 
<table id='DepartmentTable' cellpadding='0' cellspacing='0' width='600px' border='0'> 

The only one I use is...

 

ini_set('session.use_trans_sid', false);

 

I'm not going to use cookies just yet. When I tried searching for help, I seen this code and it said it would remove the SID from the address bar and it said something else about cookies. I added these lines...

 

ini_set('session.use_only_cookies', true); 
ini_set('url_rewriter.tags', '');

 

And still get the same error. The form is in a seperate page (along with the thank-you page). Here is the main page code...

www.yuchniuk.com/contactus.txt

and the form...

www.yuchniuk.com/contactusform.txt

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.