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 6230875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:49:54+00:00 2026-05-24T09:49:54+00:00

echo <input type=\text\ size=3 name=\{$item[\name\]}\/>; but following works fine echo <input type=\text\ size=3 name=\{$item[‘name’]}\/>;

  • 0
echo "<input  type=\"text\" size=3 name=\"{$item[\"name\"]}\"/>";

but following works fine

echo "<input  type=\"text\" size=3 name=\"{$item['name']}\"/>";

As per my understanding \” really escape the “

  • 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-24T09:49:56+00:00Added an answer on May 24, 2026 at 9:49 am

    You don’t need to escape the quotes inside the {}. That’s supposed to be quoted because it means the string index "name" for the PHP array $name. Without quotes (or escaped quotes), name is treated as a constant (which I’m assuming it isn’t), and then you’ve got an extra pair of quotes which don’t belong.

    OTOH, this would also be correct:

    echo "<input  type=\"text\" size=\"3\" name=\"$item[name]\"/>";
    

    (no quotes around name and no {} either)

    see http://www.php.net/manual/en/language.types.string.php#language.types.string.parsing


    re:comment

    Any non-keyword without quotes or the $ sign is regarded as a constant (as you can define with the define function), thus "name" (with quotes) is a string, and name without quotes is a constant.

    when written like this, however:

    echo "{$item[name]}";
    

    PHP will first look for a constant with the name name, then if it doesn’t exist, it will use the string "name". However, it will (depending on your settings?) also issue a warning.

    • 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 : <input type=text value=<?php echo $_GET['msg']; ?>> This input
I have the following button: <input type=button count='<?php echo count($_SESSION['children']);?>' name=children class=add_child value=Add Another
$regexp = '/(?:<input\stype=hidden\sname=){1}([a-zA-Z0-9]*)(?:\svalue=1\s\/>)/'; $response = '<input type=hidden name=7d37dddd0eb2c85b8d394ef36b35f54f value=1 />'; preg_match($regexp, $response, $matches); echo
when i do a direct input feild as text the input comes through fine
<form method = post action = <?php echo $_SERVER['PHP_SELF']; ?> /> Username:<input type =
I have a field in MySQL of type text, using the following collation: utf8_general_ci
I have a hidden field <input type = 'hidden' name = test1 id =
I'm looking for the best way to take a simple input: echo -n Enter
echo $_POST[name]; //returns the value a user typed into the name field I would
I am trying to click an input type checkbox.. when clicked an AJAX call

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.