Jump to content

phpsql1

Members
  • Posts

    25
  • Joined

  • Last visited

    Never

Everything posted by phpsql1

  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
  14. the first page has a accept input with value = 'next'. once I hit 'next' the php relative to the form of the first page is called (gnrlFrm_Pass.php) this file contains the following <?php $user = trim($_POST['username']); $email = trim($_POST['email']); iclude("gnrlFrm_Main.htm"); ?> where username and email are input of type 'text' in (gnrlFrm_Pass.htm). and I want to transfer the values in these input to the appropriate inputs in the second page (gnrlFrm_Pass.htm), so that when this page is loaded the info should be there (for the user not to enter them again) thanks
  15. I have two html pages the first one has email, and name input s. the second page should have amoung other things these two info. I want to display this name and email into the apropriate inputs of the second page while it is being loaded I already assigned those values to variables in php file but my concern is mainly how to use them. any ideas. thanks
  16. I have two html pages the first one has email, and name input s. the second page should have amoung other things these two info. I want to display them into the apropriate inputs of the second page while it is being loaded I already assigned those values to variables in php file but my concern is mainly how to use them. any ideas. thanks
  17. Sorry about that. the right line is the following: $figImage=addslashes(fread(fopen($figpath,"r"),filesize($figpath))); regards;
  18. am trying to upload images in MySql using php. whenever I run the following code I get this message: Warning: fread(): supplied argument is not a valid stream resource in C:\webs\test\CNST Projects\Genaral Upload Form\figUpload.php on line 6 config.php is where I assign the database, the user, and the password. openDB.php is where the database is opened closeDB.php is where the database is closed Code: <?php include'phpFigures/config.php'; include'phpFigures/openDB.php'; include'phpFigures/assignValues.php'; if (isset($figpath)){ $figImage=addslashes(fread(fopen($figpath,"r"),filesize($figpath))); $query = "INSERT INTO images(description, image) VALUES ('$figdescription', '$figImage')"; mysql_query($query) or die("Query failed: " . mysql_error()); echo "The figure is successfully Uploaded!"; } else{ echo "You did not Upload any figure!"; } include'phpFigures/closeDB.php'; ?>
  19. In deed it is. Thanks a lot for the info.
  20. MAn you're a life saver. thanks a lot One more question. When the user comes back t finish entering data I want him to start where he ended up last time. Do I need another field to remember the page if the status field says incomplete
  21. I am working on a web site using html, php and mysql. I am dividing the page to sections (Personal info section, Project Section, figure section…) I have each section on a separate page. I want to give the user the possibility to save the information he entered and finish it later on. Can any 1 throw some hints? Should I save the entered data in the same database and keep track of the (page/section) where he stopped at, or save the info in a separate (‘temporary’) database and once he’s done parse this data to the permanent database. Thanks
  22. phpsql1

    any ideas

    I am working on a web site using html, php and mysql. I am dividing the page to sections (Personal info section, Project Section, figure section…) I have each section on a separate page. I want to give the user the possibility to save the information he entered and finish it later on. Can any 1 throw some hints? Should I save the entered data in the same database and keep track of the (page/section) where he stopped at, or save the info in a separate (‘temporary’) database and once he’s done parse this data to the permanent database. Thanks
  23. I am working on a web site using html, php and mysql. I am dividing the page to sections (Personal info section, Project Section, figure section…) I have each section on a separate page. I want to give the user the possibility to save the information he entered and finish it later on. Can any 1 throw some hints? Should I save the entered data in the same database and keep track of the (page/section) where he stopped at, or save the info in a separate (‘temporary’) database and once he’s done parse this data to the permanent database. 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.