SimplePortal

Customization => Custom Coding => Topic started by: PavelK on January 15, 2016, 05:13:58 AM

Title: page with php type and textarea field
Post by: PavelK on January 15, 2016, 05:13:58 AM
I'm create a simple page with php type and code:
Code: [Select]
echo "<form method=\"post\" action=\"/index.php?page=fb\" >";

echo "<b>field text</b><br>";
echo "<input class=\"form\" name=\"totic\" size=\"42\" type=\"text\"/>";

echo "<br>";

echo "<b>field textarea</b><br>";
echo "<textarea name=\"msg\" cols=80 rows=6></textarea>";

echo "<br>";

echo "<div class=\"center\"><input type=\"submit\" name=\"submit\" value=\"Send\"/></div>";

echo "</form>";
echo "</center>";

If I'm put something to textarea and press Send, I'm get error:
Quote
The topic or board you are looking for appears to be either missing or off limits to you.

PHP version is:5.2.17
No any mods.
SMF Version: 2.0.11
SP Version: 2.3.6

Pages in simpleportal not support forms or I do something wrong?
Title: Re: page with php type and textarea field
Post by: Chen Zhen on January 15, 2016, 06:20:00 PM
Code: [Select]
global $scripturl;
echo '
<form method="post" action="', $scripturl, '?page=fb">
<b>field text</b><br />
<input class="form" name="totic" size="42" type="text" />
<br />
<b>field textarea</b><br />
<textarea name="msg1" cols="80" rows="6"></textarea>
<br />
<div class="center"><input type="submit" name="submit" value="Send" /></div>
</form>';

You can not use "msg" as the name attribute for any of your input tags as this conflicts with SMF's ../Sources/Display.php file.
The above is your code but using the msg1 attribute in its stead.
Title: Re: page with php type and textarea field
Post by: PavelK on January 16, 2016, 08:14:30 AM
Code: [Select]
global $scripturl;
echo '
<form method="post" action="', $scripturl, '?page=fb">
<b>field text</b><br />
<input class="form" name="totic" size="42" type="text" />
<br />
<b>field textarea</b><br />
<textarea name="msg1" cols="80" rows="6"></textarea>
<br />
<div class="center"><input type="submit" name="submit" value="Send" /></div>
</form>';

You can not use "msg" as the name attribute for any of your input tags as this conflicts with SMF's ../Sources/Display.php file.
The above is your code but using the msg1 attribute in its stead.
Yes, in this way all is right. Thanks!
SimplePortal 2.3.8 © 2008-2024, SimplePortal