Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELLO ALL!! I'm new to this forum, PHP know how to talk!!

Status
Not open for further replies.

GAstrada

Programmer
Sep 20, 2000
97
Being a long time Clipper programmer, many "headaches" arrived with php and mysql to me.

Not the syntax, (Since Pascal it's basically the same), but: "the way how php process the script make the problem, (to me, very new to php)".

It's Imortant to understand that php works from the server's side, and all other, html, javascript, etc., works from the client side.

So, is not easy to PHP to "talk to the user, if an error is encountered": maybe somewhat stupid to a biginner like me, but, believe me: this problem has manyyyyy programmers in the world!!!!, in other forums.

I've found a some strange syntax way to override the problem:

Concept: If javascript code is embedded into php, it ONLY will display if the script crashes or encounter an error that the script is prepared to "catch" tipycally a validation code, or simply the php stops for any reason.

Well: the problem is how to return to the calling page, who's form was in the "action", to call that php code:

Code:
        if ($malbase == 1)  // asumme is an error
        {
            echo "<script type='text/javascript'>";
            echo "alert('BASE INEXISTENTE')";
            echo "</script>";

            echo '<META HTTP-EQUIV="REFRESH"  CONTENT="1;URL=ingbase.html">';

            exit("Base inexistente");
        }
...... somewhat strange, to Clipper programmer like me, overall because the URL is SAVED, before the EXIT is excecuted, maybe php remember the url before exit.
By the way, the url is the html which form has in the action de php code.

Well, I publish this code that WORKS, in aknowledge of many years of working with all of you.
By the way, if someone of you can explain how this piece of script works as well as it does (hundred I've seen doesen't work in other forums), I'll be very, very pleasant.

Tanks to all in advance!!!!!!!
 
si quieres, escriba su pregunta en espagnol. No entendía lo que tu escribiste.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top