i have a problem in submited data
when i type the data in textarea as
1
3
5
the output comes as
1 3 5
i want output as i submit
plz help me
my script is given below
index.php
Code: Select all
<form id="form1" name="form1" method="post" action="submit_sms.php">
Name:
<input name="subform" type="hidden" id="subform" value="1" />
<br />
<input name="txtName" type="text" id="txtName" />
<br />
Location:<br />
<input name="txtLocation" type="text" id="txtLocation" />
<br />
Mobile:<br />
<input name="txtMobile" type="text" id="txtMobile" />
<br />
Catagory:<br />
<select name="lstCat" id="lstCat">
<option value="funny">Funny</option>
<option value="adult">Adult</option>
<option value="birthday">Birthday</option>
<option value="eid_sms">Eid SMS</option>
</select>
<br />
Message:<br />
<textarea name="txtMessage" id="txtMessage" style="border:1px solid #666666; height:100px;"></textarea>
<br />
<input type="submit" name="Submit" value="Submit" />
</p>
</form>
<a href="viewsms.php?q=funny">Funny SMS</a> | <a href="viewsms.php?q=Adult">Adult SMS</a> | <a href="viewsms.php?q=birthday">birthday SMS</a> | <a href="viewsms.php?q=eid_sms">Eid SMS</a>submit_sms.php
Code: Select all
<?php
$name = $_REQUEST["txtName"];
$city = $_REQUEST["txtLocation"];
$mobile = $_REQUEST["txtMobile"];
$cat = $_REQUEST["lstCat"];
$sms = $_REQUEST["txtMessage"];
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("sms", $con);
mysql_query("INSERT INTO tbtest (user_name, user_location, user_mobile, sms_cat, sms_data)
VALUES ('" . $name ."','" . $city . "','" . $mobile . "','" . $cat . "','" . $sms . "')");
echo "Your Sms Submited Successfully. Thanks ."
?>viewsms.php
Code: Select all
<?php
$q = $_GET['q'];
$con = mysql_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("sms", $con);
$result = mysql_query("SELECT * FROM tbtest
WHERE sms_cat='" . $q . "'");
while($row = mysql_fetch_array($result))
{
echo $row['user_name'] . "<br>" . $row['sms_data'];
echo "<br /><hr>";
}
?>