|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hey,
I'm trying to populate the drop-down box from db on my page1.php. So I want to populate the course part of db. For example let's say I have a db of table called Exam. The fields are Name, phone, course etc etc. So I populate the drop-down with course, but on submit I want to retrieve the name,phone etc etc for that particular course and display it on my page2. How to code this part, it's kinda of confusing a bit. PHP Code:
Thanks! |
|
#2
|
|||
|
|||
|
your drop down box looks fine. couldn't you just do a query on page2? something like "SELECT * FROM clients WHERE course='{$_POST['course']}'"
|
|
#3
|
|||
|
|||
|
Wont' the below code work for page2.php.
PHP Code:
|
|
#4
|
|||
|
|||
|
$result will just show [object] if you echo it. you have to loop through $result and echo out all the data.
|
|
#5
|
|||
|
|||
|
Hope now the code is right.
PHP Code:
|
|
#6
|
|||
|
|||
|
did you try to run it? thats much faster than posting here and waiting a few hours for someone to reply.
|
|
#7
|
|||
|
|||
|
PHP Code:
Code:
Select the course: <input type="radio" name="group1"> <select name="course"> <OPTION VALUE=0><?=$options?> </select> The error on my web browser: Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'SQL server' in /var/www/page1.php on line 2 Unable to connect We have a SQL server at office with username, password and Database name Clients and Table name Course_list. How can I solve this error? Guess the code part is right. Help me! |
|
#8
|
|||
|
|||
|
the host you have is wrong. its supposed to be the location of the server with the database. if the database is on the same computer as the web server use localhost, if its on any other server, use the IP address.
|
|
#9
|
|||
|
|||
|
Hey,
I was informed it's a MS SQL and not MySQL. Should I use the PDO Drivers to connect to MS SQL server remotely? I haven't worked with MS SQL but only MySQL, that's why used this code. If MS SQL, what or how should I edit the code? |
|
#10
|
|||
|
|||
|
|
|
#11
|
|||
|
|||
|
I'm using the mssql quires.
Once I edited and executed my code. I got below error: Fatal error: Call to undefined function mssql_connect() in /var/www/page1.php on line 2 I messed up with php and apache thing on my windows. For now I'm working with Linux. How can fix this error? |
|
#12
|
|||
|
|||
|
do you have the mssql extension installed?
|
|
#13
|
|||
|
|||
|
I checked out my phpinfo, where I found only Mysql but not anything even related to mssql.
How to install mssql on my linux? Is it a module or an installer like MySQL? I have installed LAMP server through synaptic package manager. |
|
#14
|
|||
|
|||
|
check you php extensions directory to find the mssql.so extension file. if its there then you just need to modify the php.ini file in the extensions section to include that extension. if the file is not there, then you would need to download the extension and put it in the extensions folder then modify the php.ini file like above. on windows if there is an extension that I need I just go to php.net and download the non-installer zip version and it generally has all the php extensions then just copy over what I need. on linux I don't know if you need to use some package manager or if there is somewhere in the lamp setup that you can do it.
|
|
#15
|
|||
|
|||
|
Well, I'll check with Linux guys for this issue.
Also, I'm trying to repair my php and apache2 on windows. When I edit my php.ini file and come to restart my apache, it would give me an error message "The operation failed" I don't know why. This started happening when I extracted phpmyadmin to C:/apache2.2/htdocs/phpmyadmin. Where my browser displayed error on http://localhost/phpmyadmin/index.php Error: my sql extension not found. Please check PHP ... When I started to work on that issue, my applications got corrupted and started doing weird things like this |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > To populate drop-down on one page and display the contents on 2nd page |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|