Hi all!
I have a script with a form with:
action="loadPhoto.php"
enctype = "multipart/form-data"
method="POST"
an input type=file and a submit button.
So when you click submit the php-script checks that the choosen file is a image-file and that the size isn't to big and saves it to server.
When you press the submit button, the file is uploaded, I get directed to the php-page and I redirect back to the origin page where the image is displayed.

How can I do this dynamicly??
I want to press the submit button and not get redirected to the php-page.
I just dunamicly want to "wait" on the "submit"-page and show something like "loading...", and when it is loaded, render it on screen again. All this without redirection.

Please help me!!

Marcux

You could do this a number of ways. The easiest, in my opinion would be Flash.
However, if Flash isn't an option, JDOMP or AJAX will do it. Both of these will require some understanding of JavaScript and the DOM. In all three however, the same basic steps occur. Variables are sent to the php script and the output of the php script is sent back as a response. The url never changes.

Thanks buddylee17 that was exactly what I was after.
I realy liked JDOMP it seems like a realy good way to do it.
One thing I can't see clear is when I look at the code is when I send my var to the php-script like: "...myscript.php?myvar=value"
In php: How do I get hold of myvar??
$_GET or is it $_POST

Many thanks

If it's in the query string (myscript.php?myvar=value), you use get: $var=$_GET['myvar']; You can put as many variables as needed into the query string:myscript.php?myvar=value&var2=value&var3=value...
Go to google and search for something. You'll notice many variables in the url.

Thanks again!
The exaples you showed in your JDOMP does these url:s show up in the webbrowser?
If they are how do I make it a "POST", cos' then you will not get the url in the browser if I'm not wrong, right?
Second of all, isn't there a limit on length in the "GET" method, and not a limit in the "POST" method?

No, with AJAX, JDOMP, or Flash, the url is never seen. The request is sent "behind the scenes". The user doesn't see any change in the url throughout the data exchange. Here is a simple example of how it works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.