submit a form with smarty

556 views
Skip to first unread message

smarty

unread,
Aug 17, 2012, 7:10:29 AM8/17/12
to smarty-d...@googlegroups.com
Hi,
I would like submit to php my form but the $_POST content is empty.

in index.php
 $_POST['name'] is empty
.tpl:
<form action="index.php" method="post" >
<input type="text" name="name" />
<input type="submit" name="submit" />
</form>

can you help me to submit correctly my form ?

thanks

Silas Nyundu

unread,
Aug 17, 2012, 7:39:34 AM8/17/12
to smarty-d...@googlegroups.com
Hi , I tryd testing your code with php/htm and it works. verify the way you are referencing name value in .php.

//.htm code
   <form action="index.php" method="post" >

    <input type="text" name="name" />

    <input type="submit" name="submit" />
    </form>

//.php code
<?php

print_r($_POST);
echo $_POST['name'];


--
You received this message because you are subscribed to the Google Groups "Smarty Developers" group.
To view this discussion on the web visit https://groups.google.com/d/msg/smarty-developers/-/02Hv0yPsJAIJ.
To post to this group, send email to smarty-d...@googlegroups.com.
To unsubscribe from this group, send email to smarty-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/smarty-developers?hl=en.



--
Kind Regards
ssnyundu


bimal

unread,
Aug 17, 2012, 4:03:23 PM8/17/12
to smarty-d...@googlegroups.com
At what point did you try to read $_POST['name']?
If your file with the <form> tag and the php script is same
(index.php) then, you should write something like:

<?php

# Make sure that the user clicked on your submit button (or, use the
index - name)
if(!empty($_POST['submit'])
{
# do something on the user data
}
else
{
# show the form to enter the data
Reply all
Reply to author
Forward
0 new messages