Jump to content

UrbanDweller

Members
  • Posts

    123
  • Joined

  • Last visited

Posts posted by UrbanDweller

  1. Hey all,

     

    Im trying to edit a css/html drop down menu I got off the net, one thing I had to change was making classes for the main menubar buttons to allow for different editing for text etc.

     

    This issue is that the drop down menu on Unit Converters doesnt come down when hovered over, maybe due to the new class.

    If you could have a look and see where i made a mistake would be awesome!!

     

    Thanks a lot.

     

    HTML CODE:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <!--[if IE]>
    <style type="text/css" media="screen">
    body {
    behavior: url(csshover.htc);
    font-size: 100%;
    }
    
    #menu ul li {float: left; width: 100%;}
    #menu ul li a {height: 1%;} 
    
    #menu a, #menu h2 {
    font: bold 0.7em/1.4em arial, helvetica, sans-serif;
    }
    </style>
    <![endif]-->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <link href="Untitled-2.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="menu">
    <ul>
    	<li class="header"><a href="hs4.html">HOME</a></li>
    </ul>
    <ul>
    	<li class="header"><a href="hs4.html">UNIT CONVERTERS</a></li>
    	<ul>
          		<li><a href="hs4.html">Length</a></li>
    		<li><a href="hs5.html">Weight</a></li>			
    		<li><a href="hs6.html">Volume</a></li>
    	</ul>
    </ul>
    <ul>
        <li class="header"><a href="hs4.html">CALCULATORS</a></li>
            <ul>
                <li><a href="">Age Calculator</a></li>
            </ul>
        </ul>
        <ul>
            <li class="header"><a href="hs4.html">SEND EQUATION</a></li>
        </ul>
        <ul>
            <li class="header"><a href="hs4.html">FAQ'S</a></li>
        </ul>
        <ul>
            <li class="header"><a href="hs4.html">CONTACT US</a></li>
        </ul>						
    </div>
    </body>
    </html>
    

     

    CSS CODE:

    @charset "utf-8";
    /* CSS Document */
    
    #menu {
    background: #eee;
    float: left;
    }
    #menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    width: auto;
    float: left;
    }
    #menu a, .header a{
    font: 11px/16px Verdana, Geneva, sans-serif;
    text-align: center;
    display: block;
    margin: 0;
    text-transform:uppercase;
    text-decoration: none;
    }
    
    #menu .header a{
    font-weight: bold;
    padding: 8px 10px 0 10px;
    border-right: 1px solid #C7E0FC;
    height: 26px;
    color: #666;
    background-image: url(styles/menubar/menuline.gif);
    background-repeat:repeat-x;
    text-transform:uppercase;
    }
    
    #menu .header a:hover{
    font-weight: bold;
    padding: 8px 10px 0 10px;
    text-align: center;
    height: 26px;
    color: #333;
    background-image: url(styles/menubar/menuline1.gif);
    background-repeat:repeat-x;
    text-transform:uppercase;
    color: #000;
    text-decoration: none;
    width:auto;
    }
    
    #menu ul ul li a {
    color: #000;
    background-image:url(styles/menubar/bg_04%5B3%5D.gif);
    }
    
    #menu ul ul li a:hover {
    color: #a00;
    background-image: url(styles/menubar/bg_04%5B2%5D.gif);
    }
    
    #menu li {position: relative;}
    
    #menu ul ul {
    position: absolute;
    z-index: 500;
    }
    
    div#menu ul ul,
    div#menu ul .header a:hover ul ul,
    {display: none;}
    
    div#menu ul .header a:hover ul,
    div#menu ul ul li:hover ul,
    {display: block;}
    

  2. Hey all,

     

    Ive been trying to load external html and javascript to multilple pages, the html/php loads fine but I cant seem to get the javascript running.

     

    Ive tried: <script type="text/javascript" src="js.js"></script> (tried with html php and js) and multiple other option any ideas?

     

    Thanks

     

  3. Hey everyone,

     

    I just wanted to post to say how happy I am to have found phpfreaks forum, where everyone is so kind and all out to help you with a problem is great. My site has made huge progress since joining

     

    I'm still very new to php/sql so cant contribute to much to code support at the moment but i sure have learnt a lot trolling these forums :P

     

    But yeah thanks to all you devoted members!!  :D

  4. Thanks that works, but it seems to be getting stuck at that if statement though even when i enter a number.

     

    function checkform(){
    $weight = $_POST["weight"];
    $null = $_POST["unit_1"];
    $null_1 = $_POST["unit_2"];
    if(empty($_POST['unit_1']) && empty($_POST['unit_2']) && empty($_POST['submit']))
    {	
    	form();
    }
    elseif(!is_int($_POST['weight']))
    {
    	form();
    	echo 'enter a number in length';
    }
    else
    {
    	$unit_2 = $null_1 - 1;
    	$unit_1 = $null - 1;
    	conversion($unit_1, $unit_2, $weight);
    }
    }
    

  5. Hey ive recently had a go at php/sql and found its quite fun and requires lots of problem solving which can be pretty enjoyable. My question is what books are out there that are good to learn the basics to advanced of php & mysql and possibly a good reference book.

     

    Any thoughts would be good.

     

    Thanks

    UrbanDweller

  6. Im so sure this is the same as ur example but it doesnt seem to work test_flag doesnt change then it just goes back to the first page wen i click 2nd form

     

    <?php
    //User $_POST input
    $rownum = $_POST["rownum"];
    $colnum = $_POST["colnum"];
    $dbname = $_POST["dbname"];
    $tblname = $_POST["tblname"];
    $test_flag = $_POST['test_flag'];
    
       
        print "Test_flag ==> ".$test_flag."<br/>";
    if($test_flag != '1'){
       		checksubmit( $dbname, $colnum, $rownum, $tblname);
    }else{
       		page3( $dbname, $colnum, $rownum, $tblname);
       	}
    
    function checksubmit( $dbname, $colnum, $rownum, $tblname){
    	if(isset($_POST['enter'])){	
    		checkform( $dbname, $colnum, $rownum, $tblname);
    	}else{
    		page1($dbname, $colnum, $rownum, $tblname);
    	}
        }
    
    function checkform( $dbname, $colnum, $rownum, $tblname){
    	if(empty($_POST['colnum']) || empty($_POST['rownum']) || empty($_POST['dbname'])|| empty($_POST['tblname'])){
    		echo "Please fill out ALL of the form";
    		page1( $dbname, $colnum, $rownum, $tblname);
    	}
    	elseif(!is_numeric($_POST['rownum']) || !is_numeric($_POST['colnum'])){
    		echo "Enter number of rows and columns need";
    		page1($dbname, $colnum, $rownum, $tblname);
    	}else{
    		$test_flag = 1;
    		page2( $dbname, $colnum, $rownum, $tblname);
    	}
    }	
    
    
    function page1( $dbname, $colnum, $rownum, $tblname){
    	echo "<form method='post' action=''>
    	<table>
    	<tr>
    		<td>Database name:</td><td><input type='text' name='dbname' /></td>
    	</tr><tr>
    		<td>Table name:</td><td><input type='text' name='tblname' /></td>
    	</tr><tr>
    		<td>No. of Columns:</td><td><input type='text' name='colnum' /></td>
    	</tr><tr>
    		<td>No. of rows:</td><td><input type='text' name='rownum' /></td>
    	</tr><tr>
    		<td colspan='2' align='right'><input type='submit' name='enter' value='enter' /></td>
    	</tr>
    	</table>
    	</form>
    	";
    }
    
    function page2( $dbname, $colnum, $rownum, $tblname){					  
    	for($i = 1; $i <= $colnum; $i++){
    		$tc1 = "<td><input class='col colname' type='text' name='col_$colnum'/></td>
    							<td class='col datatype'>
    								<select name='datatype_$colnum'/>
    									<option name'flt' value='integer'>Integer</option>
    									<option name'flt' value='float'>Float</option>
    									<option name'flt' value='string'>String</option>
    								</select>
    							</td>";
    		$tc2 = $tc2 . $tc1;
       }
    	echo" 
    	<table>	
    		<tr>
    			<td>Database name:</td><td><input type='text' name='dbname' value='$dbname' /></td>
    		</tr>
    		<tr>
    			<td>Table Name:</td><td><input type='text' name='tblname' value='$tblname' /></td>
    		</tr>
    	</table>
    	<form method='post' action=''>
    	<div id='table'>
    	<table id='db_table' cellpadding='3' cellspacing='0'>
    		<tr>
    			<td class='side' cellpadding='0' cellspacing='0' rowspan='$rownum'>Column Titles</td>
    			$tc2
    		</tr>
    	</table>
    	<br/>
    	<input type='submit' name='return' value='return' />
    	</form>
    	</div>";
    }
    
    function page3(	 $dbname, $colnum, $rownum, $tblname)
    {
    	echo 'woot woot';	
    }
    ?>

     

    Sorry bout the constant code posts but its just ive been trying to get this working for far too long  :(

  7. Here the actual code im trying to implement it into as is in a class it doesnt work quite right as i have little knowledge of how they function but if you could look over it.

     

    <?php
    //User $_POST input
    $rownum = $_POST["rownum"];
    $colnum = $_POST["colnum"];
    $dbname = $_POST["dbname"];
    $tblname = $_POST["tblname"];
    $test_flag = $_POST['test_flag'];
    
    
    form::submit( $dbname, $colnum, $rownum, $tblname, $test_flag );
    
    class form{
    function submit( $dbname, $colnum, $rownum, $tblname, $test_flag )
    {
    if($test_flag != '1')
       {
       	self::checksubmit( $dbname, $colnum, $rownum, $tblname, $test_flag );
       }
       else
       {
         self::page3( $dbname, $colnum, $rownum, $tblname, $test_flag );
       }
    }
    
    
    function checksubmit( $dbname, $colnum, $rownum, $tblname, $test_flag ){
    	if(isset($_POST['enter'])) 
    	{	
    		self::checkform( $dbname, $colnum, $rownum, $tblnam, $test_flage );
    	}
    	else
    	{
    		self::page1($dbname, $colnum, $rownum, $tblname, $test_flag );
    	}
        }
    
    
    	function checkform( $dbname, $colnum, $rownum, $tblname, $test_flag )
    {
    	if(empty($_POST['colnum']) || empty($_POST['rownum']) || empty($_POST['dbname'])|| empty($_POST['tblname']))
    	{
    		echo "Please fill out ALL of the form";
    		self::page1( $dbname, $colnum, $rownum, $tblname, $test_flag );
    	}
    	elseif(!is_numeric($_POST['rownum']) || !is_numeric($_POST['colnum']))
    	{
    		echo "Enter number of rows and columns need";
    		self::page1($dbname, $colnum, $rownum, $tblname, $test_flag );
    	}
    	else
    	{
    		$test_flag = 1;
    		self::page2( $dbname, $colnum, $rownum, $tblname, $test_flag );
    	}
    }	
    
    
    function page1( $dbname, $colnum, $rownum, $tblname, $test_flag ){
    
    	echo "<form method='post' action=''>
    	<table>
    	<tr>
    		<td>Database name:</td><td><input type='text' name='dbname' /></td>
    	</tr><tr>
    		<td>Table name:</td><td><input type='text' name='tblname' /></td>
    	</tr><tr>
    		<td>No. of Columns:</td><td><input type='text' name='colnum' /></td>
    	</tr><tr>
    		<td>No. of rows:</td><td><input type='text' name='rownum' /></td>
    	</tr><tr>
    		<td colspan='2' align='right'><input type='submit' name='enter' value='enter' /></td>
    	</tr>
    	</table>
    	</form>
    	";
    }
    
    
    function page2( $dbname, $colnum, $rownum, $tblname, $test_flag ) 
    {						  
    	for($i = 1; $i <= $colnum; $i++){
    		$tc1 = "<td><input class='col colname' type='text' name='col_$colnum'/></td>
    							<td class='col datatype'>
    								<select name='datatype_$colnum'/>
    									<option name'flt' value='integer'>Integer</option>
    									<option name'flt' value='float'>Float</option>
    									<option name'flt' value='string'>String</option>
    								</select>
    							</td>";
    		$tc2 = $tc2 . $tc1;
       }
    
    	echo" 
    	<table>	
    		<tr>
    			<td>Database name:</td><td><input type='text' name='dbname' value='$dbname' /></td>
    		</tr>
    		<tr>
    			<td>Table Name:</td><td><input type='text' name='tblname' value='$tblname' /></td>
    		</tr>
    	</table>
    	<form method='post' action=''>
    	<div id='table'>
    	<table id='db_table' cellpadding='3' cellspacing='0'>
    		<tr>
    			<td class='side' cellpadding='0' cellspacing='0' rowspan='$rownum'>Column Titles</td>
    			$tc2
    		</tr>
    	</table>
    	<br/>
    	<input type='submit' name='addrow' value='addrow' />
    	</form>
    	</div>";
    	self::submit( $dbname, $colnum, $rownum, $tblname, $test_flag );
    }
    
    function page3(	 $dbname, $colnum, $rownum, $tblname, $test_flag )
    {
    	echo 'woot woot';	
    }
    
    
    
    }
    ?>

     

    I think the error maybe here calling a function b4 its needed

    	function page2( $dbname, $colnum, $rownum, $tblname, $test_flag ) 
    {						  
    	for($i = 1; $i <= $colnum; $i++){
    		$tc1 = "<td><input class='col colname' type='text' name='col_$colnum'/></td>
    							<td class='col datatype'>
    								<select name='datatype_$colnum'/>
    									<option name'flt' value='integer'>Integer</option>
    									<option name'flt' value='float'>Float</option>
    									<option name'flt' value='string'>String</option>
    								</select>
    							</td>";
    		$tc2 = $tc2 . $tc1;
       }
    
    	echo" 
    	<table>	
    		<tr>
    			<td>Database name:</td><td><input type='text' name='dbname' value='$dbname' /></td>
    		</tr>
    		<tr>
    			<td>Table Name:</td><td><input type='text' name='tblname' value='$tblname' /></td>
    		</tr>
    	</table>
    	<form method='post' action=''>
    	<div id='table'>
    	<table id='db_table' cellpadding='3' cellspacing='0'>
    		<tr>
    			<td class='side' cellpadding='0' cellspacing='0' rowspan='$rownum'>Column Titles</td>
    			$tc2
    		</tr>
    	</table>
    	<br/>
    	<input type='submit' name='addrow' value='addrow' />
    	</form>
    	</div>";
    	self::submit( $dbname, $colnum, $rownum, $tblname, $test_flag );
    }

     

    TA  :D

  8. Hey guys, im new to php and have become stuck with having more than one html form/submit that will relays to another piece of code to view something

     

    At the moment my first form works but once i submit my second form it relays back to the first form how can i prevent this so i can have many submit forms on one php page?

     

    Thanks

     

    <?php
       $dbname = $_POST['dbname'];
       $tblname = $_POST['tblname'];
       
       checksubmit( $dbname);
       function checksubmit( $dbname){
          if(isset($_POST['enter'])) 
          {   
             checkform( $dbname);
          }
          else
          {
             page1( $dbname);
          }
       }
          
       function checkform ($dbname){
          if(empty($_POST['dbname'])){
             echo 'fill out database name';
          }
          else
             page2( $dbname );
       }
          
       function page1( $dbname){
    
       echo "
          <form method='post' action=''>
          <table>
          <tr>
             <td>Database name:</td><td><input type='text' name='dbname' /></td>
          </tr><tr> 
             <td colspan='2' align='right'><input type='submit' name='enter' value='enter' /></td>
          </tr>
          </table>
          </form>
       ";
       }
          
       function page2( $dbname ){
          echo "
             <form method='post' action=''>
             <table>
             <tr>
                <td>Table Name:</td><td><input type='text' name='tblname' /></td>
             </tr><tr> 
                <td colspan='2' align='right'><input type='submit' name='return' value='return' /></td>
             </tr>
             </table>
             </form>
          ";
          
          if(isset($_POST['return'])) 
          {   
             page3( $dbname );
          }
          
    
       }
          function page3( $dbname )
                   {
             echo 'I want to make it here';
          }
    ?>

     

    :confused:

×
×
  • 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.