Advertisement
BaneD

For Kate

Dec 19th, 2014
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.99 KB | None | 0 0
  1. ////////////////////Code in Webpage http://www.recruitingblt.comli.com/add-new-sales-record.html
  2.  
  3.  
  4. <div id="regcon">
  5.  
  6. <FORM NAME = "reg" action="database.php">
  7.  
  8. <div style="width:150px; float:left; display:inline-block; font-family: Verdana;
  9.  
  10. font-size: 12px; padding-left:13px;"> Enter Client Name: </div>
  11.  
  12. <input type="text" id="textbox" name="regnum" size="30"/>
  13.  
  14. <input name="Submit"  type="submit" value="Get Form"/>
  15.  
  16. </form>
  17.  
  18. </div>
  19.  
  20. ////////////////////Code in database.php
  21.  
  22. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  23. <html xmlns="http://www.w3.org/1999/xhtml">
  24. <head>
  25. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  26. <title>Database test</title>
  27. </head>
  28.  
  29. <?php
  30. //This checks if the regnum is set or not, if it is, we use it and search DB, but if it is not, we just skip it and show the plain, empty jotform instead.
  31. if(isset($_GET['regnum']) && $_GET['regnum'] !== '')
  32. {
  33.     $regnum = $_GET['regnum'];
  34.  
  35.     $db_host = 'mysql6.000webhost.com';
  36.     $db_username = 'a8748341_blt';
  37.     $db_password = '********';
  38.     $db_name = 'a8748341_bltrec';
  39.  
  40.     mysql_connect( $db_host, $db_username, $db_password) or die(mysql_error());
  41.     mysql_select_db($db_name);
  42.  
  43.     // Check for the registration number which is a feild REG in the database  - These should be unique
  44.  
  45.     $result = mysql_query("SELECT * FROM bltrecruiting WHERE Client_Name='$regnum'") or die(mysql_error());
  46.     $row = mysql_fetch_array( $result );
  47.     if (empty($row[Client_Name]))
  48.         {
  49.             echo "No previous record of Client: $regnum <br>";
  50.             echo "Please try again <br>" ?>
  51.            
  52.             <div id=regcon>
  53.                 <FORM NAME = "reg" action=database.php>
  54.                 <div style=width:150px; float:left; display:inline-block; font-family: Verdana;
  55.                 font-size: 12px; padding-left:13px;> Client Name: </div>
  56.    
  57.                 <input type="text" id="textbox" name="regnum" size="20"/>
  58.                 <input name="Submit"  type="submit" value="Get Form"/>
  59.    
  60.                 </form>
  61.             </div>
  62.            
  63.             <?php
  64.         }
  65.     else
  66.     {
  67.         // Get the fields from the database
  68.         $address = $row['Client_Address'];
  69.         $phonenumber = $row['Client_Phone'];
  70.         $name= $row['Attn_Name1'];
  71.         //add your additional fields here
  72.        
  73.         //You can replace this section to match yours, the important part is the if at the start
  74.         $params = 'clientName=1&address[addr_line1]=2&address[addr_line2]=3&address[city]=4&address[state]=5&address[postal]=6&invoiceName1=7&email15=8&name216=9&email2=10';
  75.  
  76.     echo '<iframe id="43438603456356" frameborder="0" scrolling="no" style="width: 100%; border: medium none; height: 1118px;" name="43438603456356" allowtransparency="true" src="http://www.jotformeu.com/form/43438603456356?<?php echo $params; ?>"></iframe>';
  77.            
  78.     }
  79. }
  80. else
  81. {
  82.     echo '<iframe id="43438603456356" frameborder="0" scrolling="no" style="width: 100%; border: medium none; height: 1118px;" name="43438603456356" allowtransparency="true" src="http://www.jotformeu.com/form/43438603456356"></iframe>';
  83. }
  84. ?>
  85. </body>
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement