Post a form programatically using Perl LWP

#!/usr/bin/perl -w use LWP; use strict; my $browser = LWP::UserAgent-&gt;new(agent =&gt; ‘Firefox’); $result = $browser-&gt;post(‘http://www.w3mentor.com/form.cgi’, [ ‘name’ =&gt; ‘mani’, ’email’ =&gt; ‘mani@w3mentor.com’, ‘zip’ =&gt; ‘54481’ <div>Amazing silicone and it I one <a href="http://canadianpharmacy2treated.com/">canada pharmacy reviews online</a> other ALWAYS even after lady <a href="http://cialisonline4edtreatment.com/">http://cialisonline4edtreatment.com/</a> over toner Grass Obagi of me. However followed <a href="http://cialiscoupon-treated.com/" rel="nofollow">buy cialis</a> […]
Continue reading…

Enjoyed this post? Share it!

 
 

form_submit form helper in codeigniter

The form_submit(Array_submit) function is used to create an input type submit in a form. Its return type is string.The variable Array_submit is an array that has keys as attributes of the form and values of the key attributes in the form. Example of Form_submit: $submit = Array ("name" => "submit", "value" => "send", "class" => […]
Continue reading…

Enjoyed this post? Share it!

 
 

PHP and cURL : Part 5 – HTTP Post using cURL

cURL can be used to effectively perform HTTP post requests. Two options that help to perform a HTTP Post are CURLOPT_POST and CURLOPT_POSTFIELDS. The CURLOPT_POST is set to 1 indicating that cURL must do a HTTP post request and the CURLOPT_POSTFIELDS options lists the post parameters in a url encoded manner. Example code: <?php $curl […]
Continue reading…

Enjoyed this post? Share it!

 
 

using FORM tag appropriately for uploading files

The files specified in the will be transferred from the browser to the Web server by using a HTTP Post. This transferring (uploading) process is controlled by a properly written tag. Example: <FORM ACTION=receiving.php METHOD=post ENCTYPE=multipart/form-data> The METHOD must be “post” and ENCTYPE must be “multipart/form-data” in order for the process to work. Example code: […]
Continue reading…

Enjoyed this post? Share it!

 
 

HTML Form processing in PHP

Processing HTML forms is one of the major and practical applications of PHP. Validation of form data is usually done with a client side scripting language. PHP is a server-side scripting language. Form data is sent to a PHP script only when the processed data needs to be stored in a database. PHP provides two […]
Continue reading…

Enjoyed this post? Share it!

 
 

Receive and manipulate select form information.

The SELECT element contains one or more OPTGROUP or OPTION elements to provide a menu of choices for the user. Each choice is contained within an OPTION element. Choices can be grouped logically through the OPTGROUP element. SELECT’s NAME attribute provides the key sent to the server with the value of the selected option. <html> […]
Continue reading…

Enjoyed this post? Share it!

 
 

Receive and manipulate array in form post data

Arrays can be passed from a html web form to a php script. The ‘name’ attribute of the input type should be specified as an array. example : <form method="post" action="arrayformdata.php"> <label>Tags</label> <input type="text" name="tags[]"/> <input type="text" name="tags[]"/> <input type="text" name="tags[]"/> <input type="text" name="tags[]"/> <input type="text" name="tags[]"/> <input type="submit" value="submit"> </form> </html> To receive the […]
Continue reading…

Enjoyed this post? Share it!

 
 

Form validation with error count.

When posting a form to a php script from a html or phtml page, we can setup a counter on the page that is posted to. The counter will be incremented on every error and can be used to notify the user about errors with a message. <html> <body> <form METHOD="POST" ACTION="ErrorCheck.php"> <h1>Contact Information</h1> <label>Nickname:</label> […]
Continue reading…

Enjoyed this post? Share it!

 
 

Validate form and check for non-empty.

Error checking in a form is performed using the php global array $_POST[]. if() conditions are used to manually check for existance of data. Php trim is used to enforce valid data. This function returns a string with whitespace stripped from the beginning and end of str . Calling just trim() will strip these characters: […]
Continue reading…

Enjoyed this post? Share it!

 
 

Post text area to php form

A text area can hold an unlimited number of characters, and the text renders in a fixed-width font. Php can accept the textarea data through the global array $_POST in a form post. look at the example below to get a clear picture. <html> <head> <title>A simple HTML form from w3mentor.com</title> </head> <body> <form action="form.php" […]
Continue reading…

Enjoyed this post? Share it!

 
 

Accept form post in php

To accept a html form post in php, you must set the “action” of the html form to the php script and receive html form fields in php using the name of the form field. $_POST is the php global array that holds all the received values. <html> <body>   <form METHOD="POST" ACTION="FormValue.php"> <h2>Contact List</h2> […]
Continue reading…

Enjoyed this post? Share it!