Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/11/2021 in all areas

  1. Create an array of those field names which are to be read only, for example $readonly = ['id', 'username', 'email']; then $ro = (in_array($key, $readonly)) ? 'readonly' : '';
    2 points
  2. Hopefully you understand what I wrote for you as well as Barand's finish with the extra array to help identify those items to be R/O. As for php mode switching - I don't know who would think that doing things that way is 'clearer'. If anything it is more clumsy and adds so much to the coding as to make it tedious to read as well as to maintain later on. As for the 'extra line' complaint. Well - that means you need to stop with the loop to build the form and actually build it manually so that you can place the fields where you want them. Learn the use of css and div tags as well as margins, padding and perhaps html tables despite the current downplaying of that style of presentation. Having fun?
    1 point
  3. Thank you both for your replies, I now have it working. I have a blank line separating each data line, but that is no big deal. Re your comments ginerjm, I have followed several on-line tutorials to create my code and I must admit I don't understand all of it. I have searched for a good tutorial and not found one which starts from basics and actually explains how it all works, which results in me copying code, using it and hoping for the best. Some of the tutorials conflict with other, which is not helpful. The multiple php calls was from a tutorial which maintained that it was clearer that way, but on balance I think I agree with you. Thanks for your help Mick
    1 point
  4. A little cleaned up version of your code and my notes on it. echo "<form method='POST'>"; foreach ($assetx as $key => $value) { echo "<label>" . ucfirst($key) . " "; $ro = ($key === 'id') ? 'readonly' : ''; echo "<input type='text' name='$key' id='$key' value='$value' $ro>" echo '</label><br>'; } echo "<input type='submit' name='submit' value='Submit'>"; echo '</form>'; 1. One doesn't have to keep going into and out of php mode. It especially makes it easier to comprehend if one doesn't. 2. I can't find any mention of an 'escape' function in my php manual. Can you explain what you are trying to do with your use of it? 3 Your foreach is processing an array I assume. If that is so, how do you expect to have 2 keys having the same value of 'id' ?
    1 point
  5. It's not PHP that is timing out, it's Apache. It's waiting for the PHP process to provide a response but it eventually gives up. You can set it's timeout duration using Timeout or ProxyTimeout.
    1 point
This leaderboard is set to New York/GMT-05:00
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.