Banderson 29 Junior Poster in Training

If you get an error make sure it is not an access denied. An access denied is pretty common if your on a windows server. Because your requesting xmlhttp.open("GET",url,true); and windows is funny about those things.

Try this:

here is the ajax/javascript

var xmlhttp;
function showCD(str, div)
{

xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var url="getbrands.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged(div)
{
if (xmlhttp.readyState==4)
{
document.getElementById(div).innerHTML=xmlhttp.responseText;
}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}

here is the html

<div id="brandContainer">
<ul id="brandNav">
<li class="categorypage" id="face"><a href="javascript:showCD

('a','brandPage')">A</a></li>
</ul>
<div id="brandPage"></div>
</div>


and here is the php(getbrands.php)

<?php

$q=$_GET["q"];

$handle = fopen("http://www.totalbeauty.com/resource/lists", "r");
while (($data = fgetcsv($handle, ";;")) !== FALSE) {
	$brands= $data[0];
    }
$brand = explode(",", $brands);
for ($i=0; $i<=count($brand); $i++){
	
	$a=strtolower($brand[$i]);
	$display = "<ul>";
	if ($q = $a[0]){
		$display .= "<li>'".$a."'</li>";
	}
	$display .="</ul>";
	echo $display;
}


?>
Banderson 29 Junior Poster in Training

Right click on the loaded page and view source, copy and paste the header info down to the body tag here. Then tell me what is the full path to your template files if your using a template system.

When pasting please use the code tags

Banderson 29 Junior Poster in Training

One way is to use the $_GET reserved variable.
eg:

index.php?page=$_GET['title'];

You can read more about it at php.net

Banderson 29 Junior Poster in Training

Hi, I m new in this field. Actually I face a problem, I call a php file from a html file using javascript. I declare a variable in php file,I want to use this variable in the same html file after execution of php file.Please help.

Add .htaccess file to your directory

Inside the .htaccess file input :

AddType application/x-httpd-php .html .htm
AddHandler application/x-httpd-php .html .php .htm

This should allow you to use php in your .html files

Banderson 29 Junior Poster in Training

Could you not put the link in the array like:

<?php
if(!empty($a1[image]))
	{
		$im_array = explode("|", $a1[image]);

		$FirstImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[0]\" width=100 height=100 border=1></a>";
		
		$SecondImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[1]\" width=100 height=100 border=1></a>";

		$ThirdImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[2]\" width=100 height=100 border=1></a>";

		$FourthImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[3]\" width=100 height=100 border=1></a>";
		
		$FifthImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[4]\" width=100 height=100 border=1></a>";
		
		$SixthImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[5]\" width=100 height=100 border=1></a>";
		
	}


	$ShowInfo .= "</td>\n\t<td align=center valign=top>$FirstImage<br>$SecondImage<br>$ThirdImage<br>$FourthImage<br>$FifthImage<br>$SixthImage<br>For more information call<br><b> $a1[FirstName] $a1[LastName]<br>$a1[phone]</b><br>or click <a class=RedLink href=\"email.php?AgentID=$a1[AgentID]&ListingID=$a1[ListingID]\">here</a> to email.<center>";
	
	
	$ShowInfo .= "</center></td>\n</tr>";
?>

or am I misunderstanding the question?

Banderson 29 Junior Poster in Training

There is nothing wrong with this code. Read the first line of the exception:

Exception in thread "main" java.net.ConnectException: Connection timed out: connect

Your connection timed out. That's all.

http://www.ecst.csuchico.edu/~tlopez/javas/telneter/Telnet/Documentation/Source/socket.TimedOutException.html

Banderson 29 Junior Poster in Training

Hey,

I've recently started to learn Java with a little prior experince in C++. Only the basics.

I was just wondering if there any pointers for getting this language down. I'm talking about stuff that I won't pick up from some book or exercise. Something you've all come across in the learning process.

I think the first thing is learn the keywords, such as,

  • int
  • float
  • double
  • long
  • null
  • String
  • static

There are several more keywords to learn.

After you learn them get to know what they do , their meaning, and how to implement them into your programming to get the desired results.

Also remember that Java is Object oriented and a case-sensitive language.

That is how I started anyway.

Banderson 29 Junior Poster in Training

Go to: http://php.net/printer_open

Maybe this will help you.

Banderson 29 Junior Poster in Training

I think I am getting shorter and my wife is getting taller :lol:
I am 5' 10"

Banderson 29 Junior Poster in Training

This is how I send HTML email in my PHP Contact Form demo located at :
http://programmers-paradise.net/demos/contact/contact.php

The send email code is :

@mail($to, $subject, $message, "From: $from\nContent-Type: text/html; charset=iso-8859-1");

You can download the Contact Form at:
http://programmers-paradise.net/pafiledb/pafiledb.php?action=file&id=3

;)

Banderson 29 Junior Poster in Training

Nice to meet you Trevor.
Welcome to the community.

Banderson 29 Junior Poster in Training

I have internet explorer and Windows Me. I've set the security settings and privacy settings to default. And then when I go to the install Macromedia Player page nothing happens. It's just a empty box with a small multi colored box in the left top corner. I don't have the spywareblaster thing so that's not preventing it from using flash. I don't know what to do. I've had flash before but now it don't work.

Try downloading from Adobe at:
http://www.adobe.com/products/flashplayer/

Banderson 29 Junior Poster in Training

Look in the manual for checkdate();
Maybe this will help you.

Banderson 29 Junior Poster in Training

I recommend XAMPP if you're a beginner.
It will install Apache Server, PERL, MYSQL, PHP, PHPAdmin and other software to aid you in development.


I would also recommend installing APACHE and MYSQL as a Service.
XAMPP will ask you about this during installation.

Check to see if it's right for you.

You can get it at : http://www.apachefriends.org/ :rolleyes:

Banderson 29 Junior Poster in Training

Your Form Below:

<html>
<head>
<title>TAEKWONDO WEBSITE - Membership Form</title>
</head>
<body>
<font face="arial" size="4">
<p align="center"><big>Membership Form</big></p>
Please Fill In Your Details And Click Submit:
<br />
<fieldset><legend align="center">Personal Information</legend>
<form action="membership_form2.php" method="get">
First Name:<input type="text" name="name" size="10"/>
</fieldset>
<input type="submit" name ="submit" value="Send">
</form>
</body>
</html>

membership_form2.php Below:

<html>
<head>
<title>TAEKWONDO WEBSITE - Membership Form</title>
</head>
<body>
 
<?php
 
error_reporting(1); // Error reporting set @ 1
 
/* I submitted a code snippet at this forum concerning register_globals = off >> You can read it at : http://www.daniweb.com/code/snippet484.html */
 
if (!ini_get('register_globals')) {
$superglobals = array($_SERVER, $_ENV,
$_FILES, $_COOKIE, $_POST, $_GET);
if (isset($_SESSION)) {
array_unshift($superglobals, $_SESSION);
}
foreach ($superglobals as $superglobal) {
extract($superglobal, EXTR_SKIP);
}
ini_set('register_globals', true);
}
print "$name";
?>
</body>
</html>
Banderson 29 Junior Poster in Training

Hi, if your getting an error with drawOval then I would try drawRect();
In my opinion the while(true) and repaint(); should be in the run(); method since you should create a Thread and implement the Runnable interface.
When you call repaint in Java it automatically calls another method called update(); You should implement your own update method in your code like

public void update()
{
paint(page);
}

To reduce flicker. I hope this helps you some. ;)

Banderson 29 Junior Poster in Training

Oh my, how many times must this be repeated?

Banderson 29 Junior Poster in Training

Hi Saaski,
I am not familiar with your system, but you can try this. It might work.

When you re-boot hit F8.
Choose the Safe Mode with Command Prompt Option.
After you log in you should see the command prompt window.
In this window type: C:\Windows\system32\Restore
When you reach this directory type: rstrui.exe
This should bring up System Restore for you.

Good Luck! ;)

Banderson 29 Junior Poster in Training

Hi eboney.
I know this is a late post, but this can be used for future reference. I'm not going to go in big detail on this, but maybe this will get you started. This code will take user input convert it into an integer. If the input is in the movieid array it will output the user input along with the corresponding movie title. I hope this helps you.

public class MovieTitle
{
	public static void main(String []args)throws Exception
	{
	  
// Array examples
int [] movieId = {1001, 1002, 1003};
String [] movieTitle = {"title1001", "title1002", "title1003"};

// Declaring variables
String inputHolder = new String(); 
int x, y;

// Getting the user Input
System.out.print("Enter Movie ID: ");
char userInput = (char)System.in.read();
while(userInput >= '0' && userInput <= '9')
{
	inputHolder = inputHolder + userInput;
	userInput = (char)System.in.read();
	
}
System.in.read();

// Converting chars input to integer
int theId = Integer.parseInt(inputHolder);

// Executing for loop to match user Input to the correct movie title and ID
for(x = 0; x < movieId.length; ++x)
{

if(theId == movieId[x])
{
System.out.println("Id number " + theId + " matches movie title " + movieTitle[x]);
	   }
     }
   }
}
Banderson 29 Junior Poster in Training

Hi Noahsson,
Here is a link to some software that will do what you are wanting to do. Be sure to have windows recovery disk because it deletes your operating system too. DBan

Banderson 29 Junior Poster in Training

Hi mystique.
Personally, I recommend SmartFTP :rolleyes:

Banderson 29 Junior Poster in Training

Hi dncloud, nanosani has put you on track pretty good. You use equals to compare strings. If you do not care whether or not the case of the two strings are identical you can use the equalsIgnoreCase() method.

Banderson 29 Junior Poster in Training

Hi L. Shelby,
JAVA contains a pre-built class named Math. To use it insert this statement at the top of your program =>
import java.lang.Math.*;

This class is static which means it is class variables and class methods. This class is very useful to caculate simple mathematical problems.

Banderson 29 Junior Poster in Training

Hello johnroach1985,
The error deprecated API is nothing to worry about. Your codes will compile and run fine. API stands for application programming interface. This simply means the way you are accessing the behaviors of your classes or objects.

Banderson 29 Junior Poster in Training

Hello Firsttimer,
I think I have the program working the way you needed it too. I usually don't complete homework projects, but you was pretty close. I changed your variable float comparison to boolean and instead of

if ( number1 == number2 ) 
if ( number1 > number2 );

I inserted

comparison = number1 >= number2;

since it is a better programming practice and less prone to error. I also inserted if, else statements for the output. I guess you want it now, right? Ok, here it is....

// Java packages
import java.awt.Graphics; // import class Graphics
import javax.swing.*; // import package javax.swing


public class ComparisonApplet extends JApplet {
boolean comparison;  
String firstNumber; // first string entered by user
String secondNumber; // second number entered by user

float number1; // first number to be compared
float number2; // second number to be compared
// initialize applet by obtaining values from user
public void init()
{


// obtain first number from user
firstNumber = JOptionPane.showInputDialog( "Enter first floating-point value" );

// obtain second number from user
secondNumber = JOptionPane.showInputDialog( "Enter second floating-point value" );

// convert numbers from type String to type float

number1 = Float.parseFloat(firstNumber);
number2 = Float.parseFloat(secondNumber);
comparison = number1 >= number2; // comparison of values entered by user

} // end method init

// draw rectangle on applets background
public void paint( Graphics g) 
{
// call superclass version of method paint
super.paint( g );

// draw rectangle starting from (15, 10) …
Banderson 29 Junior Poster in Training

Here I will create a class named StringClass and build constructors.....

public class StringClass
{
   
   public static String StringAsObject;
   
   // Defining the new Value of s when calling this method
   StringClass()
   {
  StringAsObject = "sani";
   }
   
   
   // Building Constructors
	
    public static String getStringAsObject()
    
	{
		return StringAsObject;
	}
	
	
	public void setStringAsObject(String s)
{
	StringAsObject = s;
}

}

Now I will create a class named myClass that also contains method main and call the value of s which is the string "sani"

public class myClass
{
	public static void main(String [] args)
	{
	StringClass aString = new StringClass();
	String s;
    s = aString.getStringAsObject();	

   StringClass.getStringAsObject();
   System.out.println(s);


	}
}

If this is not what you were referring to let me know because I am unclear.

Banderson 29 Junior Poster in Training

I'm not sure of what your coding? An applet or an application. If it is an applet this will get you on the right path to adding an actionListener, however, I'm not gonna code it all. Gotta have a little drama right?


public class yourClassName extends Applet implements ActionListener 
      {
           TextField yourTextField = new TextField(" ", 6);

        public void init()
          {
                  yourTextField.addActionListener(this);
}
         public void actionPerformed(ActionEvent e)
       {
        /* This is where you do the coding of what you want..
If the user hits enter when focus is on yourTextField *this* event will be executed.....  Dramatic right?*/
}
}
Banderson 29 Junior Poster in Training

I'm not sure if I understand correctly, but here it goes anyway.
I think your saying that you want to call a method into your main method which is in the tempcalc.class.

If this is what you want then say your method that you want to call is caculateTemp and it has no arguments then you would
insert caculateTemp(); where you wanted to execute that method. If the method contains arguments then you would
insert caculateTemp(your arguments here);

I probably confused you more, but I hope this helps instead.

Good Luck

Banderson 29 Junior Poster in Training

Follow the link above and get Mysql . Install it to C:\mysql just to make it simple. Then download Apache at http://apache.org/ . After you install apache server create a shortcut to your Command Prompt on your desktop. Right click and choose properties. In the properties box Start in
"C:\mysql\bin" or whatever your bin directory is. My sure apache is running and open up command prompt and type mysql. This should connect you. After you are connected you should proceed to change your login credentials. I hope this enlightens you. Cheers!