Perfidus Posted August 11, 2009 Share Posted August 11, 2009 I don't know where's the problem with this form, but I can't manage to send the vars to the PHP. They are always empty. Everything looks normal for me. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <form method="POST" action="sendmail.php" id="commentForm" enctype="text/plain" > <table width="100%" border="0" cellspacing="5" cellpadding="5"> <td bgcolor="#FFE391"><label for="cname">Name</label></td> <td colspan="6" bgcolor="#FFE391"> <input name="cname" type="text" id="cname"/> </td> </tr> <tr> <td bgcolor="#FFE391"><label for="ccity">City</label></td> <td colspan="6" bgcolor="#FFE391"><input id="ccity" name="ccity"/> </td> </tr> <tr> <td bgcolor="#FFE391"><label for="czip">Zip</label></td> <td colspan="6" bgcolor="#FFE391"><input id="czip" name="czip"/> </td> </tr> <tr> <td bgcolor="#FFE391"><label for="cemail">E-mail</label></td> <td colspan="6" bgcolor="#FFE391"><input id="cemail" name="cemail"/></td> </tr> <tr> <td colspan="7" bgcolor="#FF9224" class="table_titles"> <input class="submit" type="submit" value="Send"/> </td> </tr> </table> </form> </body> </html> <?Php echo " Name: ".$_POST['cname']."<br /> City: ".$_POST['ccity']."<br /> Zip: ".$_POST['czip']."<br /> E-mail: ".$_POST['cemail']."<br />"; ?> Link to comment https://forums.phpfreaks.com/topic/169799-really-simple-question-about-a-form-and-_post-vars/ Share on other sites More sharing options...
wildteen88 Posted August 11, 2009 Share Posted August 11, 2009 You have invalid HTML. You're not setting the type for the inputs. This is the correct way <input type="text" id="cemail" name="cemail"/> This is not <input id="cemail" name="cemail"/> Link to comment https://forums.phpfreaks.com/topic/169799-really-simple-question-about-a-form-and-_post-vars/#findComment-895788 Share on other sites More sharing options...
Perfidus Posted August 11, 2009 Author Share Posted August 11, 2009 That's right, but even with the correct syntax the vars are not displayed, what can it be? Link to comment https://forums.phpfreaks.com/topic/169799-really-simple-question-about-a-form-and-_post-vars/#findComment-895922 Share on other sites More sharing options...
wildteen88 Posted August 11, 2009 Share Posted August 11, 2009 Remove enctype="text/plain" from your <form> tag Link to comment https://forums.phpfreaks.com/topic/169799-really-simple-question-about-a-form-and-_post-vars/#findComment-895923 Share on other sites More sharing options...
Perfidus Posted August 11, 2009 Author Share Posted August 11, 2009 Yeah, I think the better option is to use enctype="text" for W3C validation... That was the point! Link to comment https://forums.phpfreaks.com/topic/169799-really-simple-question-about-a-form-and-_post-vars/#findComment-895967 Share on other sites More sharing options...
wildteen88 Posted August 11, 2009 Share Posted August 11, 2009 You don't have to set the enctype, it is not required. Link to comment https://forums.phpfreaks.com/topic/169799-really-simple-question-about-a-form-and-_post-vars/#findComment-895979 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.