Jump to content

phpsql1

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phpsql1's Achievements

Member

Member (2/5)

0

Reputation

  1. Ok that's exactly what am looking for as long as I don't have to select any value of the list. I hope that's what you did mean. Thanks
  2. so then how to insert all the values of a list into a mysql table.
  3. $_POST['typeList'] holds only the selected item. can anyone help
  4. That 's what Inoticed. Howshould I solve this problem
  5. I am really stacked on how to insert all the values of a dropdown menu (select tag) into a mysql table. I am not dealing with multiple selections here. I tried foreach function but it did not work. Below is the some of what I did. Here is the definition of the List: <select name="typeList" size="5"> <option>Student</option> <option>Faculty</option> <option>Extra Help</option> <option>Extra Link</option> <option>International</option> </select> Here I assigned the List to a php variable: $ typeList = trim($_POST[‘typeList]); And here I used the foreach function to go over each value of the List into the MYSQL table (position): foreach($typeList as $tmpType) { $query = "INSERT INTO position(name, type) VALUES ('$position', '$ tmpType ')"; mysql_query($query) or die("Query failed: " . mysql_error()); } The problem with this is that foreach works only with tables, and it did not consider the list variable as a table. Anyone can help??
  6. I am really stacked on how to insert all the values of a dropdown menu (select tag) into a mysql table. I am not dealing with multiple selections here. I tried foreach function but it did not work. Below is the some of what I did. Here is the definition of the List: <select name="typeList" size="5"> <option>Student</option> <option>Faculty</option> <option>Extra Help</option> <option>Extra Link</option> <option>International</option> </select> Here I assigned the List to a php variable: $ typeList = trim($_POST[‘typeList]); And here I used the foreach function to go over each value of the List into the MYSQL table (position): foreach($typeList as $tmpType) { $query = "INSERT INTO position(name, type) VALUES ('$position', '$ tmpType ')"; mysql_query($query) or die("Query failed: " . mysql_error()); } The problem with this is that foreach works only with tables, and it did not consider the list variable as a table. Anyone can help??
  7. I assigned the lecturetype List the the php variable $lecturetype, in the hope that it will be considered as an array. <form action="submit.php" name="lecturefrm" method="post"> <table width="400" align="center" border="0" cellpadding="0" cellspacing="6"> <tr> <td style="color: #808080;">Lecture:</td> <td><input type="text" name="lecture" style="background-color: #cccccc; font-size: 16px; font-size: 16px" size="30" maxlength="45" ></td> </tr> <tr> <td style="color: #808080;">Prof: </td> <td><input type="text" name="Prof" style="background-color: #cccccc; font-size: 16px" size="30" maxlength="60"> </tr> <tr> <td>Lecture type:</td> <td style="color: #808080;"> <select name="lectureList" size="5"> <option>aaaaaa</option> <option>bbbbbbbbbbbbb</option> <option>cccccccc</option> <option>ddddddd</option> <option>eeeeeeeee</option> <option>fffffffffffff</option> <option>gggggggggggggg</option> <option>hhhhhhhhhhhhhhh</option> <option>iiiiiiiiiiiiiiiiiiiiiii</option> </select> </td> <tr> </table> </form> this is pretty much what I do have, I did not post the submit button, because I think it is not that important. Hope this hepls Again What I trying to do is to insert all the values in the list below into a mysql table. if there is any other approach please enlighten me.
  8. I do have the following List: <select name="lectureList" size="5"> <option>aaaaaa</option> <option>bbbbbbbbbbbbb</option> <option>cccccccc</option> <option>ddddddd</option> <option>eeeeeeeee</option> <option>fffffffffffff</option> <option>gggggggggggggg</option> <option>hhhhhhhhhhhhhhh</option> <option>iiiiiiiiiiiiiiiiiiiiiii</option> </select> And here I assign the variables: $lecture = trim($_POST[lecture ]); $prof= trim($_POST[prof]); $lecturetype= trim($_POST[lecturetype]); here I am trying to use foreach to add ALL the values of lecturetype list to a mysql table called lecture foreach($lecturetype as $temptype) { $query = "INSERT INTO lecture(lecture, prof, type) VALUES ('$prof', '$prof','$temptype')"; mysql_query($query) or die("Query failed: " . mysql_error()); } After running the program I got the following error: Warning: Invalid argument supplied for foreach() the explination is that foreach accepts only arrays, and $lecturetype is not an array. I am really stack with this any one have any idea.
  9. thanks I just solved it by using changing the button to accept.
  10. I do have this button <input type="button" name ="next" onclick=""> for the onclick event I wanna run a php file called next.php. I tried <input type="button" name ="next" onclick="<?php include('next.php');?>"> and <input type="button" name ="next" onclick="<?php run('next.php');?>"> but none of them worked. any ideas
  11. I do have about 400 records in an excel file that I want to transfer to a MySql database. I was adiviced to save the file as csv and then import it with phpMyAdmin. I already have php installed in computer, am just wondering if installing phpMyAdmin will affect the original installed php. Please let me know.
  12. are you trying to say this: in the first page: we have <input type "text" name "username"> in the php file related to the form of this page we have $username = $_POST(['username']) in the second page: we have: we have <input type "text" name "theuser"> this last line should be changed to <input type "text" name "usename" value "<php echo $username ?>" > is that what you 're trying to say thanks
  13. can you guys elaborate a little. to make sure we are in the same frequency this is where am blocked. in the first page: <input type "text" name "email"> let's the user inputs qqqqqq@qqqq.net and hit next The second page is loaded this page has (amoung other ethings) a field reserved for the e-mail. this field's value should be qqqqqq@qqqq.net. thanks
×
×
  • 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.