<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PHP and jQuery: Submit a form without refreshing the page</title>
	<atom:link href="http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html</link>
	<description></description>
	<lastBuildDate>Mon, 30 Jan 2012 06:32:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: hariom batra</title>
		<link>http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html/comment-page-2#comment-59246</link>
		<dc:creator>hariom batra</dc:creator>
		<pubDate>Mon, 30 Jan 2012 06:32:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=213#comment-59246</guid>
		<description>process.php does not shows the image uplaoded (means process.php does not echo the  $_FILES[&#039;fileField&#039;][&#039;name&#039;]; 
and also does not upload the uploaded file to folder)

$name = $_FILES[&#039;fileField&#039;][&#039;name&#039;];  
    $uploaddir = &#039;files/&#039;;
                $uploaddir = $uploaddir . $name;
			    $uploadfile = $name_updated;
                move_uploaded_file($_FILES[&#039;fileField&#039;][&#039;tmp_name&#039;], $uploaddir);

this coding does not works. i added enctype=&quot;multipart/form-data&quot; in the form still not working</description>
		<content:encoded><![CDATA[<p>process.php does not shows the image uplaoded (means process.php does not echo the  $_FILES['fileField']['name'];<br />
and also does not upload the uploaded file to folder)</p>
<p>$name = $_FILES['fileField']['name'];<br />
    $uploaddir = &#8216;files/&#8217;;<br />
                $uploaddir = $uploaddir . $name;<br />
			    $uploadfile = $name_updated;<br />
                move_uploaded_file($_FILES['fileField']['tmp_name'], $uploaddir);</p>
<p>this coding does not works. i added enctype=&#8221;multipart/form-data&#8221; in the form still not working</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html/comment-page-2#comment-56943</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Tue, 03 Jan 2012 05:11:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=213#comment-56943</guid>
		<description>Seems the system stripped part of my comments...

It should read something like:

To make the ‘name’ and ‘email’ dynamic you would use something like

ThankYou.html?name= $name &amp;email=  $email

Have to use PHP echo statement for $name and $email

(system stripped my php comments)</description>
		<content:encoded><![CDATA[<p>Seems the system stripped part of my comments&#8230;</p>
<p>It should read something like:</p>
<p>To make the ‘name’ and ‘email’ dynamic you would use something like</p>
<p>ThankYou.html?name= $name &amp;email=  $email</p>
<p>Have to use PHP echo statement for $name and $email</p>
<p>(system stripped my php comments)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html/comment-page-1#comment-56942</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Tue, 03 Jan 2012 05:03:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=213#comment-56942</guid>
		<description>Questions:
@Jim - Perhaps a really stupid question, but where’s the part in the php that sends the actual email and where’s the email listed to which the message is sent?

Answer: 
mail($to, $subject, $body) is what actually sends the mail message. 
$_POST[&quot;email&quot;]; is what gets the email address from the submitted form.

@Ray D - I ‘m trying to take the $name from the contact form
and not only email it back to me ( which i’ve done already) but have appear as text in another ThankYou.html file that will be called by the sendmail.php file.

Answer: With PHP you cannot pass variables between pages directly. Any variables used and information stored in them will be cleared and lost when you leave the current page. There are 2 ways you could pass the information: 
(1) You can store the information in the session and retrieve it in the next page using Something like:

$_SESSION[&#039;name&#039;] = $name;

which will store the variable contents in the session and then you can retrieve it from any page using 

$variable = $_SESSION[&#039;name&#039;];

Of course you have to have a session started before you can use this method. 

or

(2) you can pass the information as part of the HTML URL similar to:

ThankYou.html?name=name&amp;email=email

To make the &#039;name&#039; and &#039;email&#039; dynamic you would use something like

ThankYou.html?name=&amp;email=

Change the $name and $email to whatever variables you use for them in your script. This will print the $name and $email variable contents directly into the HTML URL

Then you get the information on the ThankYou.html page (right at the top) by

$name = $_GET[&#039;name&#039;];
$email = $_GET[&#039;email&#039;];

I personally prefer method 1 as method 2 is open to security issues as anyone could change the name and email values by simply typing them into the URL. Plus Method 1 allows you to store and use that information anywhere in the website. Once you are done with the information in the session you can clear it by:

unset ($_SESSION[&#039;name&#039;]);
Which clears that session variable but leaves your session in tact</description>
		<content:encoded><![CDATA[<p>Questions:<br />
@Jim &#8211; Perhaps a really stupid question, but where’s the part in the php that sends the actual email and where’s the email listed to which the message is sent?</p>
<p>Answer:<br />
mail($to, $subject, $body) is what actually sends the mail message.<br />
$_POST["email"]; is what gets the email address from the submitted form.</p>
<p>@Ray D &#8211; I ‘m trying to take the $name from the contact form<br />
and not only email it back to me ( which i’ve done already) but have appear as text in another ThankYou.html file that will be called by the sendmail.php file.</p>
<p>Answer: With PHP you cannot pass variables between pages directly. Any variables used and information stored in them will be cleared and lost when you leave the current page. There are 2 ways you could pass the information:<br />
(1) You can store the information in the session and retrieve it in the next page using Something like:</p>
<p>$_SESSION['name'] = $name;</p>
<p>which will store the variable contents in the session and then you can retrieve it from any page using </p>
<p>$variable = $_SESSION['name'];</p>
<p>Of course you have to have a session started before you can use this method. </p>
<p>or</p>
<p>(2) you can pass the information as part of the HTML URL similar to:</p>
<p>ThankYou.html?name=name&amp;email=email</p>
<p>To make the &#8216;name&#8217; and &#8216;email&#8217; dynamic you would use something like</p>
<p>ThankYou.html?name=&amp;email=</p>
<p>Change the $name and $email to whatever variables you use for them in your script. This will print the $name and $email variable contents directly into the HTML URL</p>
<p>Then you get the information on the ThankYou.html page (right at the top) by</p>
<p>$name = $_GET['name'];<br />
$email = $_GET['email'];</p>
<p>I personally prefer method 1 as method 2 is open to security issues as anyone could change the name and email values by simply typing them into the URL. Plus Method 1 allows you to store and use that information anywhere in the website. Once you are done with the information in the session you can clear it by:</p>
<p>unset ($_SESSION['name']);<br />
Which clears that session variable but leaves your session in tact</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: adrian</title>
		<link>http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html/comment-page-1#comment-52881</link>
		<dc:creator>adrian</dc:creator>
		<pubDate>Fri, 25 Nov 2011 10:53:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=213#comment-52881</guid>
		<description>Can you please give me the exact synatx to put in &quot;Process.php&quot; so that this can be sent to an email ? 
I am trying :

But not workig!</description>
		<content:encoded><![CDATA[<p>Can you please give me the exact synatx to put in &#8220;Process.php&#8221; so that this can be sent to an email ?<br />
I am trying :</p>
<p>But not workig!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html/comment-page-1#comment-51796</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Sat, 12 Nov 2011 21:17:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=213#comment-51796</guid>
		<description>Great stuff, but...  i get all kinds of stuff in the output of the post command like this

&quot;POST / HTTP/1.1
Host: xxxx.xxxxx.com:8080
Connection: keep-alive
Content-Length: 20
Origin: http://xxx.xxxxx.com
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2
Content-Type: application/x-www-form-urlencoded
Accept: */*
Referer: http://xxxxx.xxxxx.com/1test.html
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

name=1&amp;submit=Submit&quot;

My question is how can i submit ONLY the actual characters that are input.  in the above example all i would like to receive would be &quot;1&quot; (without the quotes as that is what i put in the box).  Is this possible?  i have a terminal app on the other end that is expecting only one ascii character...</description>
		<content:encoded><![CDATA[<p>Great stuff, but&#8230;  i get all kinds of stuff in the output of the post command like this</p>
<p>&#8220;POST / HTTP/1.1<br />
Host: xxxx.xxxxx.com:8080<br />
Connection: keep-alive<br />
Content-Length: 20<br />
Origin: <a href="http://xxx.xxxxx.com" rel="nofollow">http://xxx.xxxxx.com</a><br />
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.120 Safari/535.2<br />
Content-Type: application/x-www-form-urlencoded<br />
Accept: */*<br />
Referer: <a href="http://xxxxx.xxxxx.com/1test.html" rel="nofollow">http://xxxxx.xxxxx.com/1test.html</a><br />
Accept-Encoding: gzip,deflate,sdch<br />
Accept-Language: en-US,en;q=0.8<br />
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3</p>
<p>name=1&amp;submit=Submit&#8221;</p>
<p>My question is how can i submit ONLY the actual characters that are input.  in the above example all i would like to receive would be &#8220;1&#8243; (without the quotes as that is what i put in the box).  Is this possible?  i have a terminal app on the other end that is expecting only one ascii character&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simple Ajax(PHP and jQuery: Submit a form without refreshing the page) &#171; nawabpurwebs</title>
		<link>http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html/comment-page-1#comment-50768</link>
		<dc:creator>Simple Ajax(PHP and jQuery: Submit a form without refreshing the page) &#171; nawabpurwebs</dc:creator>
		<pubDate>Tue, 01 Nov 2011 15:37:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=213#comment-50768</guid>
		<description>[...] 1: http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html Share this:TwitterFacebookLike this:LikeBe the first to like this post. [...]</description>
		<content:encoded><![CDATA[<p>[...] 1: http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html Share this:TwitterFacebookLike this:LikeBe the first to like this post. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: waseem</title>
		<link>http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html/comment-page-1#comment-50092</link>
		<dc:creator>waseem</dc:creator>
		<pubDate>Tue, 25 Oct 2011 11:55:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=213#comment-50092</guid>
		<description>i want to upload teh file with this form kindly help me it is not uploading file 

my code is

 


	JQuery Form Example 
	
	
    
	$(document).ready(function(){
		$(&quot;#myform&quot;).validate({
			debug: false,
			rules: {
				name: &quot;required&quot;,
				vdo: &quot;required&quot;,
			},
			messages: {
				name: &quot;Please give the title of image&quot;,
				vdo: &quot;Please select the image&quot;,
			},
			submitHandler: function(form) {
				// do other stuff for a valid form
				$.post(&#039;form.php&#039;, $(&quot;#myform&quot;).serialize(), function(data) {
					$(&#039;#results&#039;).html(data);
				});
			}
		});
	});
	
	
	label.error { width: 250px; display: inline; color: red;}
	


 
  
&lt;!-- The Name form field --&gt;
    Title  
      
	
    &lt;!-- image uploading --&gt;
     Image
     
	

&lt;!-- The Submit button --&gt;
	 

&lt;!-- We will output the results from process.php here --&gt;






&lt;?php
	/*
	Here&#039;s where you want PHP to process the form data and do something with it, for example inserting the data into a database or sending the information to an email address and so on
	*/
	
	if(isset($_POST[&#039;submit&#039;])){
	
	
$banner_image= $_FILES[&#039;vdo&#039;]; // file name in the form

 $banner_file= $_FILES[&#039;vdo&#039;][&#039;name&#039;];

 $img_name=&quot;&quot;;

   $info = pathinfo($banner_file);

   $ext2 = strtolower($info[&#039;extension&#039;]);



   $b = uniqid(rand (),true);
 $img_nameb =&quot;image&quot;.$b.&quot;.&quot;. $ext2;
 
 $nadd3=&quot;upload/&quot;.$img_nameb; // banner_images is actually the folder name where the image is placed

 move_uploaded_file($_FILES[&#039;vdo&#039;][&#039;tmp_name&#039;], $nadd3);
 
 

print &quot;Form submitted successfully: Your name is &lt;b&gt;&quot;.$_POST[&#039;name&#039;].&quot;&lt;/b&gt; image path &lt;b&gt;&quot;.$nadd3.&quot;&lt;/b&gt;&quot;;
	
	}
?&gt;










</description>
		<content:encoded><![CDATA[<p>i want to upload teh file with this form kindly help me it is not uploading file </p>
<p>my code is</p>
<p>	JQuery Form Example </p>
<p>	$(document).ready(function(){<br />
		$(&#8220;#myform&#8221;).validate({<br />
			debug: false,<br />
			rules: {<br />
				name: &#8220;required&#8221;,<br />
				vdo: &#8220;required&#8221;,<br />
			},<br />
			messages: {<br />
				name: &#8220;Please give the title of image&#8221;,<br />
				vdo: &#8220;Please select the image&#8221;,<br />
			},<br />
			submitHandler: function(form) {<br />
				// do other stuff for a valid form<br />
				$.post(&#8216;form.php&#8217;, $(&#8220;#myform&#8221;).serialize(), function(data) {<br />
					$(&#8216;#results&#8217;).html(data);<br />
				});<br />
			}<br />
		});<br />
	});</p>
<p>	label.error { width: 250px; display: inline; color: red;}</p>
<p><!-- The Name form field --><br />
    Title  </p>
<p>    <!-- image uploading --><br />
     Image</p>
<p><!-- The Submit button --></p>
<p><!-- We will output the results from process.php here --></p>
<p>&lt;?php<br />
	/*<br />
	Here&#039;s where you want PHP to process the form data and do something with it, for example inserting the data into a database or sending the information to an email address and so on<br />
	*/</p>
<p>	if(isset($_POST[&#039;submit&#039;])){</p>
<p>$banner_image= $_FILES[&#039;vdo&#039;]; // file name in the form</p>
<p> $banner_file= $_FILES[&#039;vdo&#039;][&#039;name&#039;];</p>
<p> $img_name=&quot;&quot;;</p>
<p>   $info = pathinfo($banner_file);</p>
<p>   $ext2 = strtolower($info[&#039;extension&#039;]);</p>
<p>   $b = uniqid(rand (),true);<br />
 $img_nameb =&quot;image&quot;.$b.&quot;.&quot;. $ext2;</p>
<p> $nadd3=&quot;upload/&quot;.$img_nameb; // banner_images is actually the folder name where the image is placed</p>
<p> move_uploaded_file($_FILES[&#039;vdo&#039;][&#039;tmp_name&#039;], $nadd3);</p>
<p>print &quot;Form submitted successfully: Your name is <b>&#8220;.$_POST['name'].&#8221;</b> image path <b>&#8220;.$nadd3.&#8221;</b>&#8220;;</p>
<p>	}<br />
?&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maulik</title>
		<link>http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html/comment-page-1#comment-47694</link>
		<dc:creator>maulik</dc:creator>
		<pubDate>Wed, 28 Sep 2011 12:49:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=213#comment-47694</guid>
		<description>thanks</description>
		<content:encoded><![CDATA[<p>thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ekkahi</title>
		<link>http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html/comment-page-1#comment-47533</link>
		<dc:creator>ekkahi</dc:creator>
		<pubDate>Mon, 26 Sep 2011 11:19:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=213#comment-47533</guid>
		<description>Good example ;)</description>
		<content:encoded><![CDATA[<p>Good example <img src='http://www.askaboutphp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ray D</title>
		<link>http://www.askaboutphp.com/213/php-and-jquery-submit-a-form-without-refreshing-the-page.html/comment-page-1#comment-47061</link>
		<dc:creator>Ray D</dc:creator>
		<pubDate>Mon, 19 Sep 2011 05:56:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.askaboutphp.com/?p=213#comment-47061</guid>
		<description>Hi
Great stuff here! Thanks!

I &#039;m trying to take the $name from the contact  form 
and not only email it back to me ( which i&#039;ve done already) but have appear as text in another  ThankYou.html file that will be called by the sendmail.php file. Thus i can&#039;t ONLY use  . So basicly i&#039;m trying to get all the Input field from the Form.php page to the sendmail.php and if all is validated and correct , then send an email with the data AND also take the $name from the form and display on the thankyou html page .

Again, all is working except the last step displaying the name on the ThankYou.html page.</description>
		<content:encoded><![CDATA[<p>Hi<br />
Great stuff here! Thanks!</p>
<p>I &#8216;m trying to take the $name from the contact  form<br />
and not only email it back to me ( which i&#8217;ve done already) but have appear as text in another  ThankYou.html file that will be called by the sendmail.php file. Thus i can&#8217;t ONLY use  . So basicly i&#8217;m trying to get all the Input field from the Form.php page to the sendmail.php and if all is validated and correct , then send an email with the data AND also take the $name from the form and display on the thankyou html page .</p>
<p>Again, all is working except the last step displaying the name on the ThankYou.html page.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

