473,748 Members | 7,827 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTML Form validating with PHP, processing via ASP?

clintw
10 New Member
My problem.

I have a html contact form that is being spammed. So I have set .html to be treated as .php, in order to include php image verification into the form. However, the Action on the form originally directed to an .asp file on a remote server, which updates a database and sends a copy of the form via mail.(For various reasons, the remote server with its ASP script must do the form processing). To use the image verification, the form actions on itself. Is it possible to validate with PHP and then finally POST again to a second remote URL that uses ASP to process the contents of the submission, or is that not possible? I read somewhere, when you redirect using Location, the values of a POST are included, so would that be treated as an actual POST by the destination url if its a .asp script? I haven't dealt with ASP, so wouldn't know how to implement image verification to handle the submission completely in ASP. Any help or suggestions welcomed. Thanks
Feb 2 '07 #1
3 2019
Motoma
3,237 Recognized Expert Specialist
My problem.

I have a html contact form that is being spammed. So I have set .html to be treated as .php, in order to include php image verification into the form. However, the Action on the form originally directed to an .asp file on a remote server, which updates a database and sends a copy of the form via mail.(For various reasons, the remote server with its ASP script must do the form processing). To use the image verification, the form actions on itself. Is it possible to validate with PHP and then finally POST again to a second remote URL that uses ASP to process the contents of the submission, or is that not possible? I read somewhere, when you redirect using Location, the values of a POST are included, so would that be treated as an actual POST by the destination url if its a .asp script? I haven't dealt with ASP, so wouldn't know how to implement image verification to handle the submission completely in ASP. Any help or suggestions welcomed. Thanks
Welcome to The Scripts, clintw.
I don't believe you can POST by using a Location call.
What you can do, however, is generate a form with PHP, and then have javascript immediately submit the form using an onload.
Feb 2 '07 #2
ronverdonk
4,258 Recognized Expert Specialist
But you can POST either via JavaScript (Ajax) or using cURL. For the latter I will show you 2 examples of how to achieve this.

The first example posts a string, just like you would do with an URL parm string.
The second example POSTs an array.

When you neeed m ore information on CURL, look at the PHP documentation at CURL documentation .

Example 1, POST a parameter string[php]<?php
//
// A very simple PHP example that sends a HTTP POST to a remote site
//

$ch = curl_init();

curl_setopt($ch , CURLOPT_URL,"ht tp://www.mysite.com/tester.phtml");
curl_setopt($ch , CURLOPT_POST, 1);
curl_setopt($ch , CURLOPT_POSTFIE LDS,
"postvar1=value 1&postvar2=valu e2&postvar3=val ue3");
curl_exec ($ch);
curl_close ($ch);
?>[/php]
Example 2, POST an array[php]<?php
// ------------ POST an array via curl -----------------------

// create a new curl resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch , CURLOPT_URL, "http://path/to/your/page.php");
$id=111; $code='ABCD';

// Build the test array
$data=array( 'id'=>$id, 'code'=>'$code' );

// Do a POST
curl_setopt($ch , CURLOPT_POST, true);
curl_setopt($ch , CURLOPT_POSTFIE LDS, $data);

// grab URL, and print
curl_exec($ch);

?>[/php]
Ronald :cool:
Feb 2 '07 #3
clintw
10 New Member
Hi, thanks for the replies. Will definitely give these suggestions a try and post a followup.
Feb 5 '07 #4

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

Similar topics

2
3876
by: digihoo | last post by:
i am validating form data, but when i redirect the user back to the form page to correct the errors, all of the data they entered has disappeared. Please Help. Thanks
3
3000
by: Ray Torres | last post by:
I would appreciate any help with the following problem. I have several different htm pages with (simalar) forms that are processed by the same PHP script. If there is data missing on the form, the script displays an error page (using the header() function) and informs the user to press the browser's "Back" button. The problem is that when the user goes back to the form's htm page, all the fields are blank. I would like all
5
1510
by: karl_lopes | last post by:
Hi, I was looking for any validation code in javascript which essentially does the same thing as html tidy. i.e. The user enters some data in a form text area and I want to perform a client side data validation to ensure that it is valid xhtml before I submit the form. Any ideas? Karl.
2
2780
by: Tom | last post by:
I have written a validatedTextBox class which inherits from textBox. I've added code which validates the input text using the onValidation event. The problem I have is that when I have input invalid data and then click on the x in the upper right corner of the form to close the form or when I click on a Cancel button on the form I would like to not do the validation in that case. I have not found any event that happens when closing...
12
4845
by: Ed Mullen | last post by:
Converting some pages from HTML transitional to XHTML strict, validating at W3C. I have read ad naseum about this and am stumped. Google has a form you can include on your own Web page for searching either the Web or the resident domain (site that the search form is on) that I've been using for quite a while, successfully configuring it to validate at the W3C validator. The valid transitional code is: ------------------------------
7
6997
by: h7qvnk7q001 | last post by:
I'm trying to implement a simple server-side form validation (No Javascript). If the user submits a form with errors, I want to redisplay the same form with the errors highlighted. Once the form is correct I need to submit to another page that uses the form data. I first tried making the form submit action= field point to the same file. When the form was correct, I tried loading the next page by using <META http-equiv refresh>. But...
4
2480
by: easoftware | last post by:
I am using VS .Net 2003 and VB. I have an app with one parent and two Mdi child forms. I need to validate data in the Mdi form. The Form.Validating event works when I try to close a Mdi form, but not when I try to switch form one Mdi form to the other. I tried to add code to MdiForm1's Deactivate event: Private Sub MidForm1_Deactivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Deactivate Dim TempE As...
27
4752
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it appears that the data goes straight to the processing page, rather than the javascript seeing if data is missing and popping up an alert. I thought it may be because much of the form is populated with data from the db (lists, etc.), but when I leave...
19
3226
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But these Validating Events are also fired when either the child form or the main (parent) form Close icon is clicked. And I need for these events to know if they are being invoked because the app (or child window) is being closed. I have set a boolean...
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
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
9534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9366
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...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9241
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
8239
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...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.