Hi everyone, I have a blog (wordpress) but i want to create a independet php page. I want to post 1 variable from a form and to read this variable in my page after posting. i have created this in ASP: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <% myvar = request.form("myvar") %> </head> <body> <form action="mypage.asp" method="post"> <input type="text" name="myvar"/> <input type="submit" value="Submit"/> </form> <table> <tr> <td><%=myvar%></td> </tr> </table> </body> </html> HTML: can anyone convert this in php? thanks in advance!
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <?php $myvar = $_post["myvar"]; ?> </head> <body> <form action="mypage.asp" method="post"> <input type="text" name="myvar"/> <input type="submit" value="Submit"/> </form> <table> <tr> <td><?php echo $myvar; ?></td> </tr> </table> </body> </html> PHP:
it dosn't working. when i type a word in asp page with the code above, this word it's appears inside the table (instead of asp code). but in php it dosn't working. why? i have the wamp server version 2.0 installed.
i did this correction and it's working now: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <?php $myvar = Trim(stripslashes($_POST['myvar'])); ?> </head> <body> <form action="mypage.asp" method="post"> <input type="text" name="myvar"/> <input type="submit" value="Submit"/> </form> <table> <tr> <td><?php echo $myvar; ?></td> </tr> </table> </body> </html> HTML: