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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:41:31+00:00 2026-06-04T09:41:31+00:00

PHP echo $this->Form->create(‘Street’); echo $this->Form->input(‘street’, array(’empty’ => ‘– select –‘, ‘label’ => ‘???’)); DB

  • 0

PHP

echo $this->Form->create('Street');
echo $this->Form->input('street', array('empty' => '-- select --', 'label' => '???'));

DB

ID | Street | Description
-----------------------
1  | Foo    | Street 1 description
2  | Bar    | Street 2 description
3  | FooFoo | Street 3 description

I want to create label like:

Foo - Street 1 description

Like:

echo $this->Form->input('street', array('empty' => '-- select --', 'label' => 'Street.street - Street.description'));

How I can generate this with Cakephp Form Helper? Thanks!

  • 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-06-04T09:41:32+00:00Added an answer on June 4, 2026 at 9:41 am

    I don’t understand why you’d like to do this, but it depends on where you want to do it. If you’re in the add action obviously you cannot read from the DB because there is no such record in it yet.
    If you’re in the edit action (I assume it has been baked) you have the data in the view. So you can do the following:

    In the controller there should be something like:

    //There should be a variable called $street containing the record data for this to work
    //The following sets $street, so it is accessible as $street in the view 
    $this->set(compact('street'));
    

    In the view:

    echo $this->Form->input('street', array('empty' => '-- select --', 'label' => $street['Street']['description']));
    

    If there are many records, the $street array will be indexed.

    • 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: <h2>Add System</h2> <?php echo $this->Form->create('ReleaseServer'); echo $this->Form->input('server_name',array('error'=>array( 0 =>
Imagine this simple form <form action=<?php echo $_SERVER['REQUEST_URI']; ?> method=post> <fieldset> <legend>Contact Me</legend> <label
I have form like this: <form method=POST action=<?php echo base_url() ?>admin/admin_search> <fieldset> <label for=nalozi>Nalozi</label><input
A string looks like this: <form id=unban method=post action=unban.php?uid=<? echo $uID; ?>> <input type=hidden
I have the following code for my login view: <?php echo $session->flash('auth'); echo $this->Form->create('User',
I am using cakephp and creating a form <?php echo $form->create('User', array('action' => 'cancel'));?>
this is my HTML: <?php echo form_open(base_url().'admin'); ?> <div class=row username> <span class=icon></span> <input
I can't figure out why... This works: <?php if($_POST['test']) echo posted; ?> <form method=POST
I have the dropdown list like this <?php echo $form->dropdownList($customers,'customer_name', CHtml::listData(Customers::model()->findAll(), 'id', 'customer_name'), array(
For example… This PHP code <?php echo '<html>'; echo '<body>'; echo '<h1>Header One</h1>'; echo

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.