ShawnCplus 456 Code Monkey Team Colleague

Given that Visual C++ 6 is 10 years old I would bet the farm that it's compatibility. I would highly suggest you upgrade to a version newer than a decade old.

ShawnCplus 456 Code Monkey Team Colleague

What you're looking to get is the hostname, not the IP. http://us.php.net/manual/en/function.gethostbyaddr.php

ShawnCplus 456 Code Monkey Team Colleague

Any particular reason why you're disabling cookie functionality, that would solve your problem right there.

ShawnCplus 456 Code Monkey Team Colleague

Depending on what languages the scripts are in, PHP, Perl, etc. you have to make sure that your hosting provider supports and/or can enable support for the languages.

ShawnCplus 456 Code Monkey Team Colleague

The same holds true for PHP for both variables and functions.

class SomeClass{
  private $test1;
  public $test2;
  private getTest1(){return $this->test1;}
  public getTest2(){return $this->test2;}
}

Then if you try to access them

$blah = new SomeClass();
$test1 = $blah->getTest1(); //error
$test2 = $blah->getTest2(); //works
ShawnCplus 456 Code Monkey Team Colleague

You don't use endl; after cin you use it after cout . cin is used for input. Please use code tags as well

ShawnCplus 456 Code Monkey Team Colleague

That is called a favicon, it's pretty easy to implement just toss this in your <head></head> section.

<link rel="shortcut icon" href="location of your image here" type="image/type here" />

So if I had an image called myFavicon.jpg I would use.

<link rel="shortcut icon" href="myFavicon.jpg" type="image/jpeg" />
ShawnCplus 456 Code Monkey Team Colleague
<input type="hidden" value="<?=$rand ?>" name="rand" />

The method only applies to the form tag.

ShawnCplus 456 Code Monkey Team Colleague

You don't need a database to use Ajax. Ajax's purpose is to allow you to send asynchronous requests to a separate page and handle that request (hence the name). You can, if you want, make a request to a page which interacts with the database but Ajax itself shouldn't really interact with the database for security reasons.

ShawnCplus 456 Code Monkey Team Colleague

Not sure, just tested it and it works fine works.

ShawnCplus 456 Code Monkey Team Colleague
<input type='checkbox' name='someArray[]' value='1' />
<input type='checkbox' name='someArray[]' value='2' />
<input type='checkbox' name='someArray[]' value='3' />

Then in PHP

$someArray = $_REQUEST['someArray'];
foreach($someArray as $key=>$someElem){
    $query = "DELETE FROM someTable WHERE id = ".$someElem;
}
ShawnCplus 456 Code Monkey Team Colleague

give the <div> tag a black border and background just so you can see where it is for testing purposes, you might be misclicking

ShawnCplus 456 Code Monkey Team Colleague

OK, there is another post that deals with almost the exact same topic. You can't use relative links in emails. The recipient's email client doesn't know what or where resetPassword.php is, nor does it know where 'images/emailNotGone.png' is. You have to use absolute links, ie., http://www.example.com/resetPassword.php

ShawnCplus 456 Code Monkey Team Colleague

Have an empty div with an online attribute ie.,

<div style='height:100px;width:100px;position:absolute;top:0px;left:50px;z-index:9' onclick='window.location="www.google.com";'>
</div>

With that, if someone clicks anywhere in that 100x100 box 50 pixels from the left edge they will go to Google.

ShawnCplus 456 Code Monkey Team Colleague

You would test the form field with a regex like this.
(10, 2) in database means 10 numbers, 2 decimal places. so 12345678.90 is valid.

var testRegEx = /[0-9]{1,8}\.?[0-9]{0,2}/
var isValidNumber = form.formField.value.match(testRegEx);
ShawnCplus 456 Code Monkey Team Colleague

Use single quotes. That simple.

ShawnCplus 456 Code Monkey Team Colleague

The div should look like this if you want it to be hidden in the first place.

<div id="testDiv" style='visibility:hidden'>
ShawnCplus 456 Code Monkey Team Colleague

Arrays are always dynamic in PHP as pritaeas pointed out. As in most of the dynamic data structures in C++, you can also use array_pop and array_push in PHP.

ShawnCplus 456 Code Monkey Team Colleague

As per pretty much every other reply on the forum to posts like yours, and as per the rules: Please show some effort before asking for homework help.

ShawnCplus 456 Code Monkey Team Colleague

That is because 'hand' is deprecated in lieu of 'pointer'. 'hand' only works in Internet Explorer.

ShawnCplus 456 Code Monkey Team Colleague

OK, exactly what part isn't working. Please describe your problem

ShawnCplus 456 Code Monkey Team Colleague

Firstly I would have to significantly disagree with the lack of good PHP books. The reason there are "good" books for Perl/Python is because the users of those languages are fanboys/fangirls and would hate to decry their precious language. PHP is so widely spread at this point it is absurd to think that there are no good books on it. Any of the O'Reilly books are a good read, not to mention the entire PHP.net website which is pretty much unrivaled in language documentation in one source(aside from Java). Not to be mean but you could, you know, try reading one yourself instead of letting out a very loud sheep noise at someone else's review.

ShawnCplus 456 Code Monkey Team Colleague

... Don't close the child page before the requests are completed?

ShawnCplus 456 Code Monkey Team Colleague

Autocomplete sort of got blown to huge proportions so http://www.google.com/search?q=ajax+autocomplete should provide enough links.

ShawnCplus 456 Code Monkey Team Colleague

Well it can't be done with a normal select box, you have to pretty much hack a bunch of divs and/or spans together to act like a select box. It's been done with a few AJAX autocomplete scripts that you can tear apart.

ShawnCplus 456 Code Monkey Team Colleague

In syntax "markup" anything in angle brackets, < >, is a required field, anything inside brackets [ ], is optional. So DELETE FROM <table> means that you must have something where it says <table>, ie., DELETE FROM someTable .

That said the query format is

DELETE FROM <table > [, table [...]] [WHERE <col> = <value> [LIMIT <offset>[,<number>]

Meaning that you can do DELETE FROM someTable, someSecondTable WHERE row = 3 LIMIT 0,2 Which would delete everything from someTable and someSecondTable where row is equal to 3. Or I could simply do, DELETE FROM someTable WHERE row = 3

ShawnCplus 456 Code Monkey Team Colleague

No, the code for the trim_array function, not for clean_array

ShawnCplus 456 Code Monkey Team Colleague

It works because it's not an error since PHP is capable of implicit initialization meaning a variable is declared as soon as you use it if it was not declared before as opposed to C or C++ which requires explicit initialization.
Aside from that I meant the actual code for the function, the description of it doesn't really help when debugging it :)

ShawnCplus 456 Code Monkey Team Colleague

Well both errors are pretty helpful since they explain in plain English exactly what is going wrong.
The first

Notice: Undefined index: submit in /var/www/vhosts/domain/httpdocs/Directory/form.php on line 270

Tells you that there is an Undefined index. In this line

if ($_POST['submit'] == "Submit Search") {

The 'submit' is called an index as it is an index to the location in the array. So what the notice is saying that there is nothing defined in the 'submit' position in the $_POST array.

For the second could you show the definition of your trim_array function because it isn't a built in PHP function unless it's new to 5.2

ShawnCplus 456 Code Monkey Team Colleague

Make sure you go over to http://www.php.net/releases/ and check the changelogs for compatibility and major upgrades that can break code. Checking changelogs is always good practice when making an upgrade to prevent things like this.

ShawnCplus 456 Code Monkey Team Colleague

It's actually much easier to make bar graphs with CSS than it is with PHP.
Here's an quick tutorial http://www.khmerang.com/index.php?p=118

ShawnCplus 456 Code Monkey Team Colleague

Well this post here describes how to use modal divs, switching visibility of elements is all over the site so use the search box up in the right corner there.

ShawnCplus 456 Code Monkey Team Colleague

Is it just me or have serif fonts become the new go-to font of Web 2.0 sites. Out the window with you old, boring sans-serif Verdana. Who needs you Arial? We have Georgia, glorious Georgia, or even *gasp* Garamond. Has the serif laid it's pointy edge into the blunt broadside of the sans-serif fonts(yeah, that's a little over the top, wanna fight about it?) or do you believe that each has it's place... like when a 9 shouldn't look like it's about to crash through the floor of the current line.

ShawnCplus 456 Code Monkey Team Colleague
if (isset($_COOKIE['$Username']))
    $visits = $_COOKIE['$Username'];

Never works because variables in single quotes ', aren't parsed. You need double quotes, ie.,

if (isset($_COOKIE["$Username"]))
    $visits = $_COOKIE["$Username"];

You have to do that for all of those variables in there.

ShawnCplus 456 Code Monkey Team Colleague

selectbox.options is an array. The add() function is a member of the Element family ie., selectbox.add(<elem>); not selectbox.options.add(<elem>);

ShawnCplus 456 Code Monkey Team Colleague

The images aren't working because you are using relative paths. You have to use absolute paths(with the domain included) to be viewable outside of the host domain.

ShawnCplus 456 Code Monkey Team Colleague

Any particular reason why you are escaping these variables in this section?

\$row1=mysql_fetch_array(\$content1);
\$display_content1 = \$row1['content1'];
print \$display_content1;
print "<BR><BR>";
\$row2=mysql_fetch_array(\$content2);
\$display_content2 = \$row2['content2'];
print \$display_content2;
print "<BR><BR>";
\$row3=mysql_fetch_array(\$content3);
\$display_content3 = \$row3['content3'];
print \$display_content3;
print "<BR><BR>";

Aside from that, the unexpected $end error comes from a missing or extra } somewhere.

ShawnCplus 456 Code Monkey Team Colleague

You'd need something along the lines of this

function changeClass(elem, className1,className2)
{
    elem.className = (elem.className == className1)?className2:className1;
}

Then the anchor would look like this

<a href='#' class='class1' onclick='changeClass(this,"class1","class2");'>Hello World</a>
ShawnCplus 456 Code Monkey Team Colleague

Well making the background dark is pretty easy with CSS (Modal CSS), however, the fading part requires some javascript. However, it is possible. to get CSS/DHTML to be completely cross-browser compliant even if it does require a bit of work. QuirksMode has an excellent list of browser compatibility for CSS and JavaScript.

ShawnCplus 456 Code Monkey Team Colleague

Use the onclick attribute with a function along the lines of

Function EnableRadioButtons ( array Elements )
    For each Element in Elements
        Set Element Enabled
ShawnCplus 456 Code Monkey Team Colleague

Not unless you have software running on their system. Even if you did I could probably guarantee that no one would be happy with that invasion of privacy.

ShawnCplus 456 Code Monkey Team Colleague

You do realize that even if you did find out a way to do this that users could just disable javascript then take a screenshot(or do anything else that javascript is 'protecting') then re-enable javascript, right?

ShawnCplus 456 Code Monkey Team Colleague

Well I did that as a name or ID so they could either give a form or some other element as a parent (which realizing now would break the submit() call)

ShawnCplus 456 Code Monkey Team Colleague

This sort of turned into a thread about my function but would this work or no?

/**
 * Make sure required fields are set on a form
 * 
 * @param elements   Array of required field IDs
 * @param parentForm ID/Name of the form
 * @param setvalTar  ID of a hidden field to be set(optional)
 * @param setval       Value for setvalTar
 */
function verifyForm(elements,parentForm,setvalTar,setVal)
{
    var valid = true;
    parent = $(parentForm);
    if(!parent) parent = forms[parentForm];
    for(i=0;i<(elements.length);i++){
        if(parent.action) //will this work to make sure it's a form?
           elem = parent.elements[elements[i]];
        else
           elem = $(elements[i]);
        if(elem)
        {
            elem.value = elem.value.replace(/(^\s+)|(\s+$)/g, '');
            elem.className = (elem.value == "")?'txtError':null;
            valid = (elem.value == "")?false:valid;
        }
        else valid = false;
    }
    $('error').style.display = (valid)?'none':'';
    $('error').innerHTML = (valid)?'':'<b>Please fill in the required fields</b>';
    if(setvalTar != null && setVal != null)
        setValue(setvalTar,setVal);
    if(parentForm != null && valid)
         $(parentForm).submit();
    else return valid;
}
ShawnCplus 456 Code Monkey Team Colleague

Good looking out ~s.o.s~, maybe something along the lines of this.

/**
 * Make sure required fields are set on a form
 * 
 * @param elements   Array of required field IDs
 * @param parentForm ID of the form
 * @param setvalTar  ID of a hidden field to be set(optional)
 * @param setval       Value for setvalTar
 */
function verifyForm(elements,parentForm,setvalTar,setVal)
{
    var valid = true;
    for(i=0;i<(elements.length);i++){
        if($(elements[i]))
        {
            $(elements[i]).value = $(elements[i]).value.replace(/^\s(.*)/,'$1');
             $(elements[i]).className = ($(elements[i]).value == "")?'txtError':null;
            valid = ($(elements[i]).value == "")?false:valid;
        }
        else valid = false;
    }
    $('error').style.display = (valid)?'none':'';
    $('error').innerHTML = (valid)?'':'<b>Please fill in the required fields</b>';
    if(setvalTar != null && setVal != null)
        setValue(setvalTar,setVal);
    if(parentForm != null && valid)
         $(parentForm).submit();
    else return valid;
}

Aside from that, I also forgot to mention that you must have a CSS class that is applied to the textbox if there is an error, in this case it is called txtError but you can name it whatever you like and just change the code.

ShawnCplus 456 Code Monkey Team Colleague

Almost forgot, for that to work you need this little line, I always forget it :)

function $(id){return document.getElementById(id);}
ShawnCplus 456 Code Monkey Team Colleague

If it's not containing the necessary variables then your "getvar" function isn't working correctly, which you don't have posted here.

ShawnCplus 456 Code Monkey Team Colleague

This is a little function I wrote to verify form fields, all you need is an div with the id "error" to take the output.

/**
 * Make sure required fields are set on a form
 * 
 * @param elements   Array of required field IDs
 * @param parentForm ID of the form
 * @param setvalTar  ID of a hidden field to be set(optional)
 * @param setval  	 Value for setvalTar
 */
function verifyForm(elements,parentForm,setvalTar,setVal)
{
	var valid = true;
	for(i=0;i<(elements.length);i++){
		$(elements[i]).className = ($(elements[i]).value == "")?'txtError':null;
		valid = ($(elements[i]).value == "")?false:valid;
	}
	$('error').style.display = (valid)?'none':'';
	$('error').innerHTML = (valid)?'':'<b>Please fill in the required fields</b>';
	if(setvalTar != null && setVal != null)
		setValue(setvalTar,setVal);
	if(parentForm != null && valid)
		 $(parentForm).submit();
	else return valid;
}

Then in an html form you would have something like

<div id='error'></div>
<form action="blah.php" method="post">
    <input type="text"  name="fname" id="fname" />
    <input type="text" name="lname" id="lname" />
    <input type="button" onclick="if(verifyForm(['fname','lname'])){window.location='test.php';}" />
</form>
ShawnCplus 456 Code Monkey Team Colleague

Well the only thing you need for a modal window is two divs, and outer div to make the page modal and an inner div to hold the modal content. For example

<html>
<head>
<title>Blah</title>
<style type='text/css'>
   .modal
   {
      z-index:998;
      height:100%;width:100%;
      position:absolute;
      left:0px;top:0px; 
   }
   .modalContent{  z-index:999; }
</style>
</head>
<body>
   <div id='hello'>
       <a href='#'>You can't click on me!</a>
   
        <div id='modal' class='modal'>
            <div id='modalContent' class='modalContent'>
               <a href='#'>You can click on me though!</a>
            </div> <!-- end modal content div -->
        </div> <!-- end modal div -->
    </div><!-- end hello div -->
</body>
</html>

With that said, if you know how to do all those effects in a modeless div then you know how to do them in a modal div. Just place the content inside the inner modal div (modalContent)

ShawnCplus 456 Code Monkey Team Colleague

Well it really depends on how you want to build, I don't really have a lot of experience in CF and don't really care to but one of the main things that drew me to PHP was just how much information there is out there for it, mainly due to it being open source. But don't think PHP and CF are your only choices; Python is making it's way into the web with things like Django, and then there is Ruby on Rails which I won't comment on due to lack of experience.