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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:16:05+00:00 2026-06-05T20:16:05+00:00

I want to make this form: echo ‘<form method=post action=ratinghandler.php style=width: 250px> <input type=hidden

  • 0

I want to make this form:

echo '<form method="post" action="ratinghandler.php" style="width: 250px">
                <input type="hidden" name="reference" value= "$id"/>
                <select name="rating" style="width: 115px">
                <option> Rate </option>
                <option>1 Bad</option>
                <option>2</option>
                <option>3</option>
                <option>4</option>
                <option>5 Average</option>
                <option>6</option>
                <option>7</option>
                <option>8</option>
                <option>9</option>
                <option value="10">10 Best</option>
                </select><input name="submit1" type="submit" value="Submit Rating" /></form>';

The noteworthy portion is the hidden potion. The output in the handler page of echo $_POST[reference] is simple $id (as opposed to the value stored within $id).

I tried to change that row to read:

<input type="hidden" name="reference" value= "<? echo $id ?>"/>

I assume I am doing something fairly stupid–but I searched and did not see anything directly addressing this so I thought it would be okay to ask.

  • 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-05T20:16:06+00:00Added an answer on June 5, 2026 at 8:16 pm

    Use this syntax:

    <input type="hidden" name="reference" value= "'. $id .'"/>
    

    When you use single quotes with echo, you cannot interpolate variables. Since there are so many double-quotes in the string, single quotes were used. You can break the string and concatenate your variable using the dot operator. You can also use the comma operator to avoid string concatenation.

    If you were using double-quotes, you could leave the $id in there and it’d be interpolated, but you would then have to escape ALL of your double quotes within the string.

    Finally, you can use a HEREDOC to allow double-quotes and interpolation:

    echo <<<EOF
    <form method="post" action="ratinghandler.php" style="width: 250px">
                <input type="hidden" name="reference" value= "$id"/>
                <select name="rating" style="width: 115px">
                <option> Rate </option>
                <option>1 Bad</option>
                <option>2</option>
                <option>3</option>
                <option>4</option>
                <option>5 Average</option>
                <option>6</option>
                <option>7</option>
                <option>8</option>
                <option>9</option>
                <option value="10">10 Best</option>
                </select><input name="submit1" type="submit" value="Submit Rating" />    
    </form>
    EOF;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<?php $name=$_POST['name']; ?> <form method=POST action=<?php echo $_SERVER['PHP_SELF']; ?>> <input type=text name=name> <input type=submit
I want to make a form like this, and i want to post the
I want to refer to this post, because it might relate: Make Form Fields
I want to make a form like this in windows forms. To make a
I have this code (CodeIgniter): <tr> <td width=80>Gender*:</td> <td> <?php echo form_dropdown('gender', $gender_select, $gender_val);
I want to make a php ajax post.(post value without refresh the page) here
I want to make a php ajax post.(post value without refresh the page) here
I want to make a 2 field input form to my MySQL database. I
I am a beginner to PHP and i want to make a static method
I am using cakephp and creating a form <?php echo $form->create('User', array('action' => 'cancel'));?>

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.