Jump to content

adam84

Members
  • Posts

    289
  • Joined

  • Last visited

Posts posted by adam84

  1. This is what I have.... for some reason the five lines that deal with the border are not working in Firefox, but it is in IE. Just the background of the table changes colour. I just want to know if this is the correct logic for CSS. I do not have much experience in CSS.

     

    CSS File

    		table.innerTable{
    			border-width: 2x;
    			border-spacing: 1;
    			border-style: solid;
    			border-color: black;
    			border-collapse: separate;
    			background-color: #BFCFFE
    		}
    

     

    HTML File - a small

    <TABLE CLASS=innerTable>
    <TR>
    <TD>User Name:</TD>
    <TD><INPUT TYPE=TEXTFIELD NAME=uName ID=uName MAXLENGTH=20 SIZE=30 VALUE='''></TD>
    </TR>
    </TABLE>
    

  2. I know totally different, but I just wanted to know if I do all my data validation after my form has been submitted is that considered to be good coding or should I do the validation first in javascript, then recheck everything in PHP. As of now, I am just doing everything in PHP because in a few past posts, people have said to validate the data in PHP because Javascript can be turned off. So if a user can turn their Javascript off, is it even worth validating in Javascript at all?

     

    Thanks

  3. Alrighty, I have a search page on my site and what I want to do is when the user hits the search button. I want to build my query and all that and print out the total number of records found. But since there could be a ton of records found, I only want to display x records per page, so far no problem.

     

    My question is for me to do this would I have to build two different queries,

    1. First query to count the total number of records found.

    2. A second query to retrieve x amount of records, using LIMIT.

     

    Is this pretty much the only way of doing this??? Thanks for your help

  4. <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    
    <title>Untitled Document</title>
    <SCRIPT>
    	function divToggle(){
    		if(document.getElementById('myDiv').style.display == ''){
    			document.getElementById('myDiv').style.display = 'none'; 
    			document.getElementById('show').innerHTML = '<a href="javascript:void(0);" onclick=divToggle();>Show</a>';
    		}else{
    			document.getElementById('myDiv').style.display = '';
    			document.getElementById('show').innerHTML = '<a href="javascript:void(0);" onclick=divToggle();>Hide</a>';
    		}
    	}
    </SCRIPT>
    </head>
    
    <body>
    <table>
    	<tr>
    		<td></td>
    		<td>
    			<div id="myDiv" style="display:none"><input type="text" /><input type="text" /><input type="text" /></div>
    		</td>
    	</tr>
    </table>
    
    <DIV NAME="show" ID="show"><a href="javascript:void(0);" onclick=divToggle();>Show</a></DIV>
    
    </body>
    
    </html>
    

  5.  

    and my last questions would be how to get the form to perform an action.  Can i just change

    echo "<form>";

    to

    echo "<form action = "updateclient.php method="post">";

     

    and how do i add the button for submitting here?

     

    Like this

    echo "<form action=\"updateclient.php\" method=\"post\">";

     

  6. I used the second one and echo 'This method';

     

    It was the way I was taught. I find it my code to be cleaner that way, but in the end I guess if the code works then whatever

  7.  

    		 if(document.images) {
    		imgs = new Array("home_btn_h", "login_btn_h", "reg_btn_h", "del_forum_btn", "msgs_btn_h", "new_forum_btn_h", "reg_btn_h", "unread_btn_h");
    
    		for(var i=0; i<=imgs.size, i++) {
    			imgs[i] = new Image(87, 30);
    			imgs[i].src="assets/" + imgs[i] + ".gif";
    			alert("assets/" + imgs[i] + ".gif");
    		}
    	}

     

    You have a comma in your loop declaration. Make it

    for(var i=0; i<=imgs.length; i++) {

      whatever

    }

     

    See if that works!

  8.  

    PHP CODE

     

    $donor=$_POST["donor"];

    echo $donor;

     

    mysql_query("INSERT INTO `hope` (fname, lname, idnum, gradyear, donor) VALUES ('$_POST[fname]','$_POST[lname]','$_POST[idnum]','$_POST[gradyear]','$donor')");
    

     

     

    Try putting the $_POST outside of the quotes, and you need to have either single or double quotes to access the $_POST variables

    mysql_query("INSERT INTO `hope` (fname, lname, idnum, gradyear, donor) VALUES ('".$_POST['fname']."','".$_POST['lname']."','".$_POST['idnum']."','".$_POST['gradyear']."','$donor')");
    

     

  9. I have a site where users are able to internally send mail to each other. Would it be considered a good idea to use ajax to check and see if the user have any new mail. As of now, every time the user loads a new page, I check for any new mail and if there is I display “New Mail”. But if I created a function, that would check every x amount of seconds, would that be a waste of resources, a waste of querying the database?

     

    I really like the idea of using ajax to do that, but again not all ideas are efficient. I much rather code it efficiently, so the site runs much quicker, than a cool idea that makes the site run slow.

     

    Thanks

  10. I have a textfield

    <INPUT TYPE=TEXTFIELD NAME=handle ID=handle VALUE="<? echo stripslashes( $_GET['userHandle'] ); ?>">
    

     

    If the userHandle'value is adam84, it works fine. The value is set to adam84.

     

    But if the userHandle'value is "adam84". It messes up because of the quotes.

    I tried to use single quotes the surounds the VALUE in the TEXTFIELD, but if there is a single quote in the userHandle, it screws up.

     

    It does work if I remove the stripslashes function, but the value now comes up as \"adam84\" for the TEXTFIELD VALUE.

     

    Any ideas, how I can set a VALUE of a TEXTFIELD with quotes in it?

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