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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:23:03+00:00 2026-05-21T16:23:03+00:00

So I need to make new survey forms that are huge and I’m getting

  • 0

So I need to make new survey forms that are huge and I’m getting questions from db and adding them to array before printing.
Type of input also comes from array.
For example getting text inputs done like this:

if ($type == 'text'){//text input
$Line[] .= "<tr><td><input type='text' name='question_$q_id' $attributes   class='$classes' value=\"";
$Line[] .= '<?php if (isset($_POST[\"question_$q_id\"])){echo $_POST[\"question_$q_id\"];}?>';
$Line[] .= "\"></td></tr>\n";

So the problem is of course is if isset php part. When done like this it simply makes a string value with php code in it.

Which way should I go about to have add php code as php code?

I retrieve values into the form simply like this:

foreach ( $Line as $q_id => $line ) {
echo "$line";

I did try the eval function but it gives me an error – I’m not sure how to properly use it.

Any form I used before I had all the elements added up simply by using “echo” in the loop, but it seems like creating and filling up an array with questions and then retrieving it makes more sense, however making field values sticky is the problem for me.
Is there an easy way to fix it, or should I just get back to echoing elements in the fetch loop?

  • 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-21T16:23:03+00:00Added an answer on May 21, 2026 at 4:23 pm
    if ($type == 'text'){//text input
    
      $Line[] .= "<tr><td><input type='text' name='question_{$q_id}' {$attributes}   class='{$classes}' value=\"";
    
      if (isset($_POST["question_{$q_id}"]))
        $Line[] .= $_POST["question_{$q_id}"];
    
      $Line[] .= "\"></td></tr>\n";
    
    }
    

    In fact, a better way would to be:

    if ($type == 'text'){//text input
    
      $Line[] .= "<tr><td><input type='text' name='question_{$q_id}' {$attributes}   class='{$classes}' value=\"".isset($_POST["question_{$q_id}"])?$_POST["question_{$q_id}"]:null."\"></td></tr>\n";
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make new array of string elements, from elements in one default
I need to make sifr3 fonts from .otf fonts, how can I do that?
I have two arrays in php and I need to make a new array
I need to make a div layer so that when you click on it
I need to make a proxy script that can access a page hidden behind
I need to make a stored procedure or function that returns a set of
Need to make a new WPF control and give the Caret to it. In
I need to make a new merge of 2 commits and the total merge
I need to make a flat file PHP calendar that an admin would be
If I need to make a new object out a class in a Play

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.