Jump to content

Recommended Posts

Can someone help!!!

im trying to check if a form field is empty, though its always showing as not empty as im echoing a php session variable in the value attribute if the variable is present. Heres the form field:

[code]
<input name="page_name_<? echo $i; ?>" type="text" class="style183" size="40" value="<? echo $page_name_[$i]; ?> ">
[/code]

its also being displayed in a loop.

Basically the problem is that having:

[code] value="<? echo $page_name_[$i]; ?> "
[/code]

at the end always displays a couple of blank spaces in the form, when the variable $page_name if not present, so the return value never shows as empty.

Any help appreciated!!!!
Link to comment
https://forums.phpfreaks.com/topic/26681-form-help/
Share on other sites

no mate the loops fine,

what i want to do is either echo the valie of $page_name in the textfield or echo nothing at all, depending on whether $page_name has a value. The problem occurs when $page_name does not have a value set. The echo statement in the value attribute of the textfield then prints a few zero's, which stops the returning value of the text field showing as empty. 

Hope this makes it a bit clearer, its hard to describe.
Link to comment
https://forums.phpfreaks.com/topic/26681-form-help/#findComment-122054
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.