Jump to content

Ordinary_Shepp

New Members
  • Posts

    7
  • Joined

  • Last visited

Ordinary_Shepp's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Let us see the code first, <?php require_once 'func.php'; connect() ; ?> <!DOCTYPE html> <html> <head> </head> <body> <header> <h1 align='center'>Division Input System</h1></header> <form method="post" action="divprocess.php" enctype="multipart/form-data"> <table> <tr> <td> Division </td> <td> <input type="text" name="name" /> </td> </tr> <tr> <td> Zeo Code </td> <td> <input type="text" name="zeocode" /> </td> </tr> <tr> <td> </td> <td><input type="submit" value="Submit"></td></tr> </table> </form> </body> </html> Now if I want to enable the submit button only when the two field are populated with data what should I do ?
  2. How can I get two submit button on one form with two different action? <?php require_once 'func.php'; connect() ; ?> <!DOCTYPE html> <html> <head> </head> <body> <header> <h1 align='center'>student</h1></header> <form method="post" action="process.php" enctype="multipart/form-data"> <table> <tr> <td> </td> <td><input type="submit" value="Submit"></td></tr> </table> </form> </body> </html> Here is a code segment. I want to get two button "submit" and "go back" which should take me to the "process.php" and "index.php" . Thanks in advance for your help. And is there any way to call a php function by clicking a submit button ?
  3. Thanks man, I didn't know my necessary keyword for googling.....
  4. Hello, I am doing a project where I need to store a large volume of data in a table. So, I can't show all the data at a time. And performing a query for all those data may be time consuming. So I want to implement a view system where I can show data step by step. Say I want to show last 50 data at a time. So, It seems that I need to traverse through the rows with two button. "Previous" and "Next" . What could be the query for this purpose or how I can do it? I am using mysql and php. I am not expecting a bunch of code. But I will appreciate your comment with necessary functions for php and query ideas or examples for mysql and viewing procedure for HTML.
  5. Sorry , I didn't mention I regularly use global variables in C++.......
  6. Thanks, I do understand now. actually I come from C++ in php. So I thought global variables are accepted.
  7. Hello ! I am new in php coding. So if you please help me in this regards I'll be very happy. I have received some error while connection to my mqsql database to a php file. At first I post my code.... "login.php" <?php $db_hostname = 'localhost' ; $db_database = 'PC' ; $db_username = 'admin' ; $db_password = 'maruf' ; ?> "func.php" <?php require_once('C:\xampp\htdocs\PC\login.php') ; function connect(){ $db_server = mysql_connect( $db_hostname , $db_username , $db_password ) ; if( !$db_server )die ( "Unable to connect to MySql : ".mysql_error()) ; mysql_select_db( $db_database ) or die("Unable to select database: ".mysql_error()) ; } function close(){ mysql_close() ; } function division(){ $mydata = mysql_query("SELECT * from division order by zeocode"); if( !$mydata ) echo "Database connection failed. ".mysql_error().'<br>' ; while( $record = mysql_fetch_array($mydata)){ echo '<option value ="' . $record['$name'] . '">' . $record['$name'] . '"</option>'; } } ?> "form.php" <?php require_once 'func.php'; connect() ; ?> <!DOCTYPE html> <html> <head> form </head> <body> <header> <h1 align='center'>Census</h1></header> <p> <select name ="division"> <?php query() ?> </select> <?php close() ?> </p> </body> </html> It shows me the following error . calling from the browser -> http://localhost/PC/form.php Notice: Undefined variable: db_hostname in C:\xampp\htdocs\Population_Census\func.php on line 10 Notice: Undefined variable: db_username in C:\xampp\htdocs\Population_Census\func.php on line 10 Notice: Undefined variable: db_password in C:\xampp\htdocs\Population_Census\func.php on line 10 Notice: Undefined variable: db_database in C:\xampp\htdocs\Population_Census\func.php on line 12 Unable to select database: No database selected then I change form.php into this <?php //require_once('C:\xampp\htdocs\Population_Census\login.php') ; $db_hostname = 'localhost' ; $db_database = 'PC' ; $db_username = 'admin' ; $db_password = 'maruf' ; function connect(){ $db_server = mysql_connect( $db_hostname , $db_username , $db_password ) ; if( !$db_server )die ( "Unable to connect to MySql : ".mysql_error()) ; mysql_select_db( $db_database ) or die("Unable to select database: ".mysql_error()) ; } function close(){ mysql_close() ; } function division(){ $mydata = mysql_query("SELECT * from division order by zeocode"); if( !$mydata ) echo "Database connection failed. ".mysql_error().'<br>' ; while( $record = mysql_fetch_array($mydata)){ echo '<option value ="' . $record['$name'] . '">' . $record['$name'] . '"</option>'; } } ?> which show me exactly same problem.
×
×
  • 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.