ScrollMaster Posted April 9, 2006 Share Posted April 9, 2006 I was just making a simple test page to see if I could get a variable to carry from one page to another using $_POST but no matter what I attempt I never see the result. I do not have javascript disabled and I using PHP 5.Now to show you my codeindex.html (The page with one feild)[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta name="generator" content="Notepad++" /> <title>Post Test</title> <link href="css/basic.css" rel="stylesheet" type="text/css" media="all" /> </head> <body> <div class="container"> <form id="frm_test" action="results.php" method="POST"> <fieldset> <legend>Use Post!</legend> <input type="text" id="test"/> <input type="submit" id="sbt_results" value="Query"/> </fieldset> </form> </div> </body></html>[/code]results.php[code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <meta name="generator" content="Notepad++" /> <title>Post Results</title> <link href="css/basic.css" rel="stylesheet" type="text/css" media="all" /> </head> <body> <div class="container"> <?php $test = $_POST['test']; echo $test; ?> </div> </body></html>[/code]Am I forgetting something?EDIT: SOLVED!I have spent too much time not knowing what was wrong when I thought of adding in the NAME attribute and not everything works. I did not know name was responsible as the variable.I think this confusion all lead because of the new 1.1 Strict standards. Name is no longer used in 1.1 and if you have it in validation your page will fail. Even though I do not use the 1.1 Strict bceause 1.0 Strict the the current standard being use I had in mind to omit it anyway always because it would not be used in the future. Quote Link to comment Share on other sites More sharing options...
earl_dc10 Posted April 9, 2006 Share Posted April 9, 2006 [code] <input type="submit" id="sbt_results" value="Query"/> [/code]try changing "id" to "name"EDIT -> looks like I type too slow ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.