Jump to content

Recommended Posts

Heres the code:

[code]<?php
if($_POST['$value'] == 'a' || 'b' || 'c' || 'd' || 'e' || 'f' || 'g' || 'h' || 'i' || 'j' || 'k' || 'l' || 'm' || 'n' || 'o' || 'p' || 'q' || 'r' || 's' || 't' || 'u' || 'v' || 'w' || 'x' || 'y' || 'z')
echo "<img src='http://www.domain.com/styles/1/images";
echo "/";
echo "$value";
echo ".gif'>";
?>[/code]

Is there a way, so that ANY time a letter is typed in a textarea it is posted as an image? If theres a space I want blank.gif to display.

Example:

"I Type This"

I want: (To be displayed)

[code]<img src="http://www.domain.com/styles/1/images/i.gif">
<img src="http://www.domain.com/styles/1/images/blank.gif">
<img src="http://www.domain.com/styles/1/images/t.gif">
<img src="http://www.domain.com/styles/1/images/y.gif">
<img src="http://www.domain.com/styles/1/images/p.gif">
<img src="http://www.domain.com/styles/1/images/e.gif">
<img src="http://www.domain.com/styles/1/images/blank.gif">
<img src="http://www.domain.com/styles/1/images/t.gif">
<img src="http://www.domain.com/styles/1/images/h.gif">
<img src="http://www.domain.com/styles/1/images/i.gif">
<img src="http://www.domain.com/styles/1/images/s.gif">[/code]

The form

[code]<form action="post.php" method="POST">
<text area name="value" rows="50" cols="10">
</textarea>
</form>[/code]
Link to comment
https://forums.phpfreaks.com/topic/11499-php-postecho-help/
Share on other sites

[code]
<?php
  $blah = "I type this";
    $blah = strtolower($blah);
    $letters = preg_split('//', $blah, -1, PREG_SPLIT_NO_EMPTY);
    foreach ($letters as $val) {
       if ($val == " ") { $val = "blank"; }
          echo "<img src='http://www.domain.com/styles/1/images/".$val.".gif'>";
    }
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/11499-php-postecho-help/#findComment-43250
Share on other sites

[code]
<?php
  $blah = $_POST['example'];
    //$blah = "I type this";
    $blah = strtolower($blah);
    $letters = preg_split('//', $blah, -1, PREG_SPLIT_NO_EMPTY);
    foreach ($letters as $val) {
       if ($val == " ") { $val = "blank"; }
          echo "<img src='http://www.domain.com/styles/1/images/".$val.".gif'>";
    }
?>

<form action="<?= $PHP_SELF ?>" method="POST">
example: <input type='text' name='example'>
<input type='submit'>
</form>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/11499-php-postecho-help/#findComment-43268
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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