Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7186839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:43:02+00:00 2026-05-28T18:43:02+00:00

I am stumped by the following code: <b><i>First name *</b></i> : <input type=text name='<?php

  • 0

I am stumped by the following code:

 <b><i>First name *</b></i> : <input type="text" 
                     name='<?php Labels::$FIRSTNAMELABEL ?>'  /><br />

This ‘First Name’ field is one of several inputs on a form on my page.
The Labels:$FIRSTNAMELABEL is set in the class definition to “FirstName”.

Here is the class definition:

class Labels {
      static public $FIRSTNAMELABEL = "FirstName";
      // other static class members here for last name, phone #, etc.
      }

When the form appears in my browser I dump the page source and here’s what I get:

<form action="AddPerson.php" method="post">
<b><i>First name *</b></i> : <input type="text" 
                     name=''  /><br />

You will notice that name=’ ‘ is blank. It should say name=”FirstName” there in the page source. Not be blank.

I have tried: single quotes, double quotes, spaces, no spaces around the php block, and inside the php block around the Labels::$FIRSTNAMELABEL — no change. When the form is displayed and I dump the page source, I always get name= (blank).

I discovered this with the following line of code:

  if( isset( $_POST[Labels::$FIRSTNAMELABEL])

The ‘isset’ always returns false, so I did a page dump and found out why — when the form is submitted there IS no first name field called “FirstName” at all.

Funny thing about this is, I had this form inside a heredoc and it worked fine — here’s part of the form in my heredoc:

 <?php
  // this was successfully displaying a 'name=' field on the form set to the 
  // static class label called Labels::$FIRSTNAMELABEL -- ie. the 'name' field 
  // in the page source was name="FirstName"
 function showAddContactForm()
 {
     $firstNameLabel = Labels::$FIRSTNAMELABEL;
     // other field names not shown.....

     echo <<<_END
       <form action="AddContact.php" method="post">
       <b><i>First name *</b></i> : <input type="text" name=$firstNameLabel /><br />
      // other fields on the form not shown..
      </form>
 _END;
 }
 ?>

Why is my ‘name=’ field always blank?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:43:03+00:00Added an answer on May 28, 2026 at 6:43 pm

    At a glance, there is no echo/print.

    <b><i>First name *</b></i> : <input type="text" 
    name='<?php echo Labels::$FIRSTNAMELABEL ?>'  /><br />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code, which works fine: <input type=button name=btnHello value=Hello onclick=Test();/> and
I'm following a couple of Pythone exercises and I'm stumped at this one. #
This is my first OOP php app and I'm getting a little stumped here...
I'm not sure why this has stumped me. I have the following code $website
This one's stumped me. So I have the following sample app that is supposed
I am completely stumped as to why this code does not get any SDL
I'm completely stumped on this one. I have three different lists that need to
This one has me stumped. I've got a java.sql.ResultSet and I'm pulling string values
So I'm stumped on this one. In Mac OS X there is an easy
Why would the following code throw this error? if ([self.tableView.dataSource numberOfSectionsInTableView:self.tableView] > 0 &&

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.