user1065050
user1065050

Reputation: 61

how to post special character and symbol using php

I am new one in php.I was just create a form for sending special character and symbol using .I got for get the text

<form name='form1' method='post' action='s.php'>
<textarea name='ask' id='ask' style=' resize:none ; border: #093; height:250px;     width:350px'></textarea><input type="submit" name="button" id="button" value="Submit" /></td>
</form>

this is form and s.php is

<?php
 $ask=$_POST['ask'];
 echo $ask;
?>

inputed value

  #include<iostream.h>

but i got only

#include why did i got output like this ? and any method to get full text . Please help me anyone

Upvotes: 0

Views: 1336

Answers (1)

user142162
user142162

Reputation:

Right click and view the page source. The <iostream.h> is being interpreted as an HTML tag by your browser.

Passing the value through htmlentities() will make it work as expected:

$ask = $_POST['ask'];
echo htmlentities($ask);

Upvotes: 4

Related Questions