Jump to content

Is possible to put plain text in HTML by PHP?


Sigmahokies
 Share

Recommended Posts

Hello everyone,

I'm trying to get abbreviate states from plain text into HTML select and option, seem it's not working. Can you help me? here my PHP code:

/* Read file to insert as option in HTML */

$file = fopen("States.txt","r") or exit("Unable to read");
    while(!feof($file)) {
        $states = fgets($file);
        $statelist =  "<option value='".$states."'>".$states."</option>";
    }
fclose($file);

Then 

<tr><td>State:</td><td><select id="abb" name="abb"><?php echo $statelist ?></select></td></tr>

Thank you for help

Edited by Sigmahokies
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...