TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,831
  • Total Topics: 21,287
  • Online today: 86
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 74
  • Total: 74

"8: Undefined index" in PHP articles

Started by alienv, February 17, 2007, 03:09:44 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alienv

Hi
i've created phparticle with small form (post).
There's a submit button and a text input

And everytime someone click button i've got error report in admin
it looks like :
8: Undefined index: submit_register
File: /path/to/forum/Themes/default/TPortal.template.php (main sub template - eval?)
Line: 5


It's a way to fix it ? or at least stop reporting errors ?? ::)
Or i need to create my own module for it...

Thnx in advance

Lesmond

you could post your code, then maybe someone will come along and see whats wrong, (not me though :idiot2: when it comes to code)

alienv

i can but i doubt that there's something mesed up with the code..
howeverm here is part of code.

global $user_info;
echo '<div align="center">
<form name="register" method="post" action="">
<table>';
if ( $_POST['submit_register'] )
{
[...]
echo '<tr><td align="right">Login</td><td><input type="text" name="login" value="' . $user_info['username'] . '"/></td></tr>
<tr><td align="right">E-Mail</td><td><input type="text" name="email" value="' . $user_info['email'] . '"/></td align="right"></tr>
[...]
<tr><td colspan="2" align="center"><input type="submit" name="submit_register" value="Register" /></td></tr>
</table>
</form>
</div>';

(and i don't use $_POST['submit_register'] somewhere else)

Lesmond

umm I have read that somewhere! something about  method="post" where it tries to post to your forum, but I cant find the topic!

JPDeni

Try changing


if ( $_POST['submit_register'] )


to


if ( isset($_POST['submit_register']) )


It doesn't like the fact that it's looking for the value $_POST['submit_register'], when it's not been defined at all. If you change your "if" statement to check whether the value has been set, the program will be happy.

I run into this all the time. :)

This website is proudly hosted on Crocweb Cloud Website Hosting.