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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cant figure it out

Status
Not open for further replies.

sander123

Programmer
Feb 13, 2005
2
NL
im new to web dev. i installed apache/mysql/php

i have been able to create a simple form page :

<html>
<h1>Open New RPA trace</h1>
<form action="addrpa.php" method="post">

<title>Open New RPA
</title>


<table>
<tr><td>Airwaybill</td>
<td><input type="text" name="awb"></td></tr>
<tr><td>Youre ID</td>
<td><input type="text" name="id"></td></tr>
<tr><td>Youre Station</td>
<td><input type="text" name="station"></td></tr>
<tr><td>Youre Phone nbr </td>
<td><input type="text" name="phn"></td></tr>
<tr><td>Youre Country </td>
<td><input type="text" name="cty"></td></tr>
<tr><td>Queue To Station</td>
<td><input type="text" name="q"></td></tr>
<tr><td>Text for Trace</td>
<td><input type="text" name="trace"></td></tr>
</table>

<input type="submit" value="submit">

</form>
</html>

and php for handle store in mysql :

<?

$awb=$_POST['awb'];
$id=$_POST['id'];
$station=$_POST['station'];
$phn=$_POST['phn'];
$cty=$_POST['cty'];
$q=$_POST['q'];
$trace=$_POST['trace'];


$connection=mysql_connect("localhost", "mokum", "mokum");
mysql_select_db("rpa", $connection);

$results=mysql_query("INSERT INTO input (nmbr, awb, id, station, phn, cty, q, trace)
VALUES ('$nmbr', '$awb', '$id', '$station', '$phn', '$cty', '$q', '$trace')") or
die('Error making query');
echo'Processing';



?>


this took me 8 hours,, lol :D but this works fine.. i can do posts,, mysql adds new rows. what i want to do is, on the webserver a vb app is checking whether a new row is added in mysql, if theres a new row.. it processes it in the mainframe.. the processing etc is no issue.. thats working..

what i want is

how can i do a validation after the submit button is pressed,, validate if fields are <> "" and if some fields are numeric

then.. and here comes my unexperiance

the code i use now opens the php page,, and that page says processing.. i do not want that page to be opened.. i want the word "processing"to be displayed on the same page where the details where entered..

thats question 1

second question...

once the submit button has been pressed,, the vb app on the webserver does the updating.. that vb app will post a result on the same row.. it could be the updates on the mainframe failed... i want the html page to wait when that results field, e.g. "failed" has been updated by the vb app.. a sort of wait function i guess..

i hope i explained sufficiently, and want to thank on forehand the time you put in this.

please be precise in youre reply, like put this there etc, ( i regret not to have learned html for the last 7 years :D)

best regards

sander
 
[quote}how can i do a validation after the submit button is pressed,, validate if fields are <> "" and if some fields are numeric
[/quote]

There are a few methods to use:
php functions like empty, is_numeric;
regular expressions like ereg

which are great for validation

the code i use now opens the php page,, and that page says processing.. i do not want that page to be opened.. i want the word "processing"to be displayed on the same page where the details where entered..

Use a frameset and pass the data off to another frame which handles the submission and returns the result. The data needs to be passed to the server, so i don't really see whats wrong with just handling it the way you do currently...

once the submit button has been pressed,, the vb app on the webserver does the updating.. that vb app will post a result on the same row.. it could be the updates on the mainframe failed... i want the html page to wait when that results field, e.g. "failed" has been updated by the vb app.. a sort of wait function i guess..

PHP has the sleep function which halts the processing for a certain number of seconds. You can run a loop that tests for the value via sql, if nothing then sleep for x seconds. If the result is there, then pass that back to the user. You will need to use a php page for this, unless you want to use the html result page as a template and read it into a variable, replace the templeted result notification with the result. Or you could pass the data to a js function to be run when the onload is complete to change the result indicator to the user



Bastien

I wish my computer would do what I want it to do,
instead of what I tell it to do...
 
Thanks Bastien...


let me use google today and see what comes up.. be back this evening...


gr8 !!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top