Jump to content

Converting HTML Input into PHP


doubledee

Recommended Posts

I could use some help converting this HTML...

<textarea id="question1" name="answerArray[1]" cols="60" rows="2"><?php if (isset($answerArray[1])){echo htmlentities($answerArray[1], ENT_QUOTES);}? ></textarea>

 

...into PHP.

 

This is what I have so far, but I'm getting messed up with the Sticky Form part...

echo '<textarea id="question' . $questionNo . '" name="qaArray[' . $questionID . ']" cols="60" rows="2"> ' . '<?php if (isset($qaArray[' . $questionID . '])){echo htmlentities($qaArray[' . $questionID . '], ENT_QUOTES);} ?></textarea>';

 

Thanks,

 

 

Debbie

 

 

Link to comment
https://forums.phpfreaks.com/topic/261149-converting-html-input-into-php/
Share on other sites

Not tested Debbie, but you might try this.

echo '<textarea id="question' . $questionNo . '" name="qaArray[' . $questionID . ']" cols="60" rows="2">' .
(isset($qaArray[$questionID]) ? "htmlentities($qaArray[$questionID], ENT_QUOTES" : '').'</textarea>';

 

You can also try breaking it apart like this.

echo '<textarea id="question' . $questionNo . '" name="qaArray[' . $questionID . ']" cols="60" rows="2">'; 
if (isset($qaArray[' . $questionID . '])){echo "htmlentities($qaArray[' . $questionID . '], ENT_QUOTES)";}
echo '</textarea>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.