Current location: Hot Scripts Forums » Programming Languages » PHP » how to add html in all entrys


how to add html in all entrys

Reply
  #1 (permalink)  
Old 10-23-07, 08:51 PM
wambulance wambulance is offline
Newbie Coder
 
Join Date: Sep 2005
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
how to add html in all entrys

how do you add smething like <option value="">something</option> to every thing someone send into a mysql database. i want the value="" to have the same name as the name they type. so it would be like this
HTML Code:
<form action="insert.php" method="post">
<input type="text" name="name" />
</form>
then in insert.php i want to to send it as this.
PHP Code:

<option value="$_POST[name]">$_POST[name]</option
to the mysql database. i tried like this but it didnt work

PHP Code:

<?php

$con 
mysql_connect("localhost","","");
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db("DB"$con);

$sql="INSERT INTO tablename (name)
VALUES
('<option value='
$_POST[name]'> $_POST[name]</option>')";

if (!
mysql_query($sql,$con))
  {
  die(
'Error: ' mysql_error());
  }
echo 
"Added!!!!";

mysql_close($con)
?>

any help please?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
html tutoral thefrtman HTML/XHTML/XML 5 04-27-09 10:25 AM
HTML Form 1 -> Perl -> return response to HTML form 2 Oleks Perl 13 10-18-06 04:59 PM
How do I add the text in the script from HTML iwonder PHP 4 07-08-05 01:02 AM
Need website design or HTML coding help? website_help HTML/XHTML/XML 0 05-26-05 12:07 PM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM


All times are GMT -5. The time now is 07:31 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.