Jump to content

Recommended Posts

i'm having trouble with the drop down list. when i insert into mysql, its not inserting the drop down list selected.

 

    <form enctype='multipart/form-data' action='insert.php' method='post' name='changer'>
      <p align='center'>
      <input type='text' name='username'value='$username' readonly='readonly'> <br>
      <input type='text' name='hyperlink'value='input hyperlink here'> <br>
      <input type='text' name='name' value='input title here'> <br>
  <input type='text' name='summary' value='input summary here'> <br>
      <textarea name='info' cols='40' rows='10' wrap='hard'>input full detail here</textarea> <br>
      <font color=white>input keywords manually</font><input type='text' name='keywords' value=''><br>
       <font color=white> or </font>
      <select name 'keywords'>
<option>--Select a category--</option>
<option value='Debate'>Debate</option>
<option value='Music'>Music</option>
<option value='Jobs'>Jobs</option>
</select>
      <input type='submit' name='submit' value='Submit'><br></p></form>";

 

i named the select name keywords... i thought it would insert but its not.. i have two inputs named 'keywords' the textfield and the dropdownlist..the textfield inputs into keywords fine when submitted.  the dropdownlist doesn't insert into keywords..

 

 

    $username = mysql_real_escape_string($_POST['username']);
       $hyperlink = mysql_real_escape_string($_POST['hyperlink']);
	$name = mysql_real_escape_string($_POST['name']);
	$summary = mysql_real_escape_string($_POST['summary']);
	$info = mysql_real_escape_string($_POST['info']);
$keywords = mysql_real_escape_string($_POST['keywords']);

      // Create the query and insert
      // into our database.
      $query = "INSERT INTO Stacks";
      $query .= "(`username`,`hyperlink`,`name`,`summary`,`info`,`keywords`) VALUES ('$username','$hyperlink','$name','$summary','$info','$keywords')";

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/172832-solved-form-problem-should-be-easy/
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.