Jump to content

Recommended Posts

if there any easiest way to make dynamic form just using php coding??? i had a problem which is if i insert matric_no then if the matric_no that i had insert exist in the database,the name of the student that hold the matric_no automatically appear... i want to do with php and ajax but i not familiar with ajax.. can some one help me with this problem...?? i prefer php coding... thanks...

Link to comment
https://forums.phpfreaks.com/topic/116999-solved-dynamic-php/
Share on other sites

sorry..what i means is for example..

 

id :______

(this id will be key in by user)

name:________

(when user key in id, then automatic appear the name)...

 

i found lot of ajax script but i'm not familiar with ajax eventhough i had read it several time, so i prefer if my problem can be solve by php languange....

Link to comment
https://forums.phpfreaks.com/topic/116999-solved-dynamic-php/#findComment-601751
Share on other sites

getname.php

<?php
//replce DB credentials and name here
$db = mysql_connect("db_server", "db_user_name", "db_password");
mysql_select_db("db_name");

if($_POST['submit']) {
  $sql = "select `name` from student where id = '".mysql_escape_string($_POST['id'])."'";
  $res = mysql_query($sql);
  if(mysql_num_rows($res)>0) {
    $row = mysql_fetch_array($res); 
    $strName = $row['name'];
  } else {
    $strName = "No Student with this id..";
  }
}

?>
<form method="POST" action="getname.php">
<input type="text" name="id" value="<?php echo $_POST['id'] ?>" /><br/>
<input type="text" name="student" value="<?php echo $strName; ?>" />
<input type="submit" name="submit" value="Submit" />
</form>

 

something like this ??

Link to comment
https://forums.phpfreaks.com/topic/116999-solved-dynamic-php/#findComment-601763
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.