473,785 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

conditional posting of a record

20 New Member
Hi all

I would be grateful if you could help me in the following issue. I have a form on which I can recall records and modify them. On clicking on the push button 'post', the modified record is updated and a page called guarantee.php is called. But now I want to add some validation so that if there's a mistake in an input field e.g. 'tan' the message 'invalid input' is displayed and instead of calling the program guarantee.php, I am allowed to correct the mistake and post again. If all mistakes are corrected, on clicking post I should go back to guarantee.php but if not the error message should be displayed and I should be allowed to correct. Below are some codes which I have used to return to guarantee.php program after posting. It includes some functions, the description of which I have given in comment form.I have to modify these codes to allow me to correct the mistake and post again. Please help.


[PHP]<? function editrec($recid)
{
$res = sql_select(); // a function that selects the record to be edited
$count = sql_getrecordco unt(); // a function that gets the numbver of records in the table
mysql_data_seek ($res, $recid);
$row = mysql_fetch_ass oc($res);
showrecnav("edi t", $recid, $count); //a function creating the navigation tools depending on the no of records
?>
<br>
<form action="guarant ee.php" method="post" name="frmcampai gn">
<input type="hidden" name="sql" value="update"> //the value "update" of sql is passed to a function to enable update of a record
<input type="hidden" name="xBkg_Seri alNo" value="<? echo $row["Bkg_Serial No"] ?>">
<? showroweditor($ row) ?> // displays the fields to be edited
<p><input type="submit" name="action" value="Post"></p>
</form>
<?
mysql_free_resu lt($res);
} ?>[/PHP]

Thanks
Jul 2 '07 #1
5 1501
luke14free
79 New Member
Hi,
If I have understand what you need you could use another way.
You can use Spry Ajax(opensurce from adobe labs) and you can inset forms that doesn't allow you to continue(to your 2nd page in php) unless the value respects some standard(that you can edit such as int value, minimal/maximal long and so on...). All in jscript.
Hope to have been useful
Jul 2 '07 #2
sharmilah
20 New Member
Sorry but i am a newbie and don't know javascript. Is there no other way.
Jul 2 '07 #3
pbmods
5,821 Recognized Expert Expert
Heya, sharmilah.

Is the PHP code on the same page as the form's HTML?
Jul 2 '07 #4
kovik
1,044 Recognized Expert Top Contributor
When you submit the form, your code should check all fields for validity before any submission is complete.

Example:

Expand|Select|Wrap|Line Numbers
  1. if(!empty($_POST)) // A form has been submitted
  2. {
  3.     if(!isset($_POST['name'], $_POST['email'], $_POST['password']))
  4.     {
  5.         // Create an error message displaying that the form
  6.         //    is incomplete
  7.     }
  8.     else if(strlen($_POST['name']) < 8)
  9.     {
  10.         // Create error message displaying that the name is too short
  11.     }
  12.     else if(!preg_match(/* email regex */, $_POST['email']))
  13.     {
  14.         // Create error message regarding invalid email address
  15.     }
  16.     else
  17.     {
  18.         // Submit the data
  19.     }
  20. }
Jul 2 '07 #5
Motoma
3,237 Recognized Expert Specialist
Have your guarantee page perform the validation, and redisplay the form if the data is bad. Then the page can post to itself and you don't have to worry about automating posts between pages.
Jul 2 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
8644
by: Bob | last post by:
I need to know if there is a better way to construct this SQL statement. (Error handling is omitted) MS SQL Server 2000 Insert into FSSUTmp Select a.acct_no, a.ac_nm, a.ac_type, 10, -1, -1 * sum(CHARINDEX(convert(char(4), b.post_yr), @post_yr) * CHARINDEX('-', CONVERT(char(2), b.post_prd - @post_prd - 1)) * b.prd_trn_amt), -1 * sum(CHARINDEX(convert(char(4), b.post_yr), @post_yr) * CHARINDEX('0',
4
9800
by: Prakash Wadhwani | last post by:
I have 3 fields : First_Name, Last_Name & Policy_Number I'm using a continuous form. If I invoke conditional formatting on First_Name & set a condition of "Prakash" (change the foreground to red), it works fine. My Problem: ---------- What I'd like to do however is change the color of the foreground for
6
5512
by: Allan Koch | last post by:
Dear NG, I would like to format a record in a subform, dependent on a value in one field. If one field in the record I show in a subform (datasheet view) is true I like to view that particular row in green, all other rows just as they are normal. Is that possible ? regards Allan
4
3140
by: Bradley | last post by:
I have an A2000 database in which I have a continuous form with a tick box. There is also a text box with a conditional format that is based on the expression , if it's true then change the background colour. In A2000 it works great, but in A2003 the background doesn't always change and when it does it only changes when the record looses the focus. Any way around this? Is it a bug? Or have they "improved" it?
8
12052
by: Dimitri Furman | last post by:
Given: Access 2002/2003 A subform in datasheet or continuous view, placed on a tab page (this last may or may not matter) Conditional formatting applied to some controls on the subform - format expressions are the same for all controls Under some undetermined circumstances, when such subform is displayed, the controls on the subform start to visibly flicker, the cursor in the subform stops blinking, and CPU utilization goes to 100%....
1
3505
by: John | last post by:
My report is based off of a table. I need a record on the report to be highlighted if that record ID is in a different table. Something like, if record ID exists in Query X, then conditional format this entry on the report. Any suggestions?
3
2318
by: Chuck Reed | last post by:
I am working on a sales report where I show weekly sales by category for each of the 52 weeks in the year. Each record in my table/report has the 52 weeks of sales in it. I want to highlight to top five weeks of sales for each category by using a conditonal format to highlight these top five weeks. I've been trying to find a way to do this but have not been sucessful looking through many books on Access and in reading the user groups. If...
2
2352
by: jodyblau | last post by:
I'm not certain that what I am trying to do is possible; in any event I haven't been able to figure it out. Here is what I am trying to do: I have one table that has a list of cases I'm working on. I have a second table that contains a list of tasks to be performed and relates to the Case_List through a Case_ID. So currently, I can bring up a form that has a list of all my cases, I can then select a case and it opens a new form that...
11
3493
by: tg989 | last post by:
Okay, here goes. Continuous forms... possibly the best feature of access. The only downside is this: the only way to have a conditional evaluation run on each record invididually is by conditional formatting... this poses a problem because it is extremely limited (no wildcards, cannot access controls other than the one the formatting is on, cannot perform evaluations other than the ones give... greater than, less than etc). Is there a...
0
9484
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9957
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.