473,769 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Facing problems with $_POST. Data can not be processed by PHP...

9 New Member
I am new to the world of PHP. Below is my simple PHP file "invite.php " with a form having an image send button (I have to use the image send button because it is the requirement, may be this is causing problem!):

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  <head><title>Form</title>
  3.  </head>
  4.  <body>
  5.   <script language="javascript" src="validation.js"></script>
  6.    <form action="submit.php" method="POST"> 
  7.     <table border ="0" align="center" cellpadding="9" cellspacing="1">          
  8.      <tr>
  9.       <td colspan="2">Enter Your Friends' E-mail Addresses<br/>Separate multiple addresses with a comma<br/>
  10.        <textarea name="emails" id="emails" class="subheading" value="" rows="5" cols="52" onfocus= "javascript:if (document.getElementById('emails').value=='') { document.getElementById('emails').value=''; }" onblur="javascript:if (document.getElementById('emails').value=='') { document.getElementById('emails').value=''; }"></textarea>
  11.       </td>
  12.      </tr>
  13.      <tr>
  14.       <td>Meeting Date<br/>
  15.        <input type="text" name="inputDate" id="inputDate" class="subheading" value="" maxlength="17" size="32" onfocus= "javascript:if (document.getElementById('inputDate').value=='') { document.getElementById('inputDate').value=''; }" onblur="javascript:if (document.getElementById('inputDate').value=='') { document.getElementById('inputDate').value=''; }" />&nbsp;<img src="calendar.gif" alt="Calendar" name="calendar" width="14" height="14" id="calendar" />
  16.       </td>                                                                        
  17.       <td>Meeting Time<br/>
  18.        <input type="text" name="meettime" id="meettime" class="subheading" value=" Noon to Midnight" maxlength="36" size="36" onfocus= "javascript:if (document.getElementById('meettime').value==' Noon to Midnight') { document.getElementById('meettime').value=''; }" onblur="javascript:if (document.getElementById('meettime').value=='') { document.getElementById('meettime').value=' Noon to Midnight'; }" />
  19.       </td>
  20.      </tr>
  21.      <tr>
  22.       <td>Your Name<br/>
  23.        <input type="text" name="vname" id="vname" class="subheading" value=" Your Name" maxlength="36" size="36" onfocus= "javascript:if (document.getElementById('vname').value==' Your Name') { document.getElementById('vname').value=''; }" onblur="javascript:if (document.getElementById('vname').value=='') { document.getElementById('vname').value=' Your Name'; }" />
  24.       </td>
  25.       <td>Your E-mail Address<br/>
  26.        <input type="text" name="visitormail" id="visitormail" class="subheading" value=" Your E-Mail Address" maxlength="36" size="36" onfocus= "javascript:if (document.getElementById('visitormail').value==' Your E-Mail Address') { document.getElementById('visitormail').value=''; }" onblur="javascript:if (document.getElementById('visitormail').value=='') { document.getElementById('visitormail').value=' Your E-Mail Address'; }" /> 
  27.       </td>
  28.      </tr>
  29.      <tr>
  30.       <td colspan="2">Optional Message<br/>
  31.        <textarea name="message" id="message" class="subheading" value="" rows="5" cols="52" onfocus= "javascript:if (document.getElementById('message').value=='') { document.getElementById('message').value=''; }" onblur="javascript:if (document.getElementById('message').value=='') { document.getElementById('message').value=''; }"></textarea>
  32.         <p align="left"><input type="image" src="send.gif" name="send" alt="Send" value="Send" onclick="fValidateContact(this.form); return false;"  /></p> 
  33.       </td>
  34.      </tr>
  35.     </table>
  36.    </form>
  37.  </body>
  38. </html>
  39.  
  40. The file mentioned in (action="submit.php") is as under:
  41.  
  42. <html>
  43.  <head><title>Success Message</title>
  44.  </head>
  45.  <body>
  46.   <?php
  47. $inputDate = $HTTP_POST_VARS['inputDate'];
  48. $meettime = $HTTP_POST_VARS['meettime'];
  49. $visitormail = $_POST['visitormail'];
  50.    ?>   
  51.   <table border ="0" align="center" cellpadding="9">          
  52.     <tr>
  53.      <td align="center"><p align="center">Success! Your Data has been processed by PHP. Details are: <br />
  54.      Your Email address was: <?php echo $visitormail; ?><br />
  55.      Meeting Date was : <?php echo $inputDate ?><br />
  56.      Meeting Time was : <?php echo $meettime ?><br /></p>
  57.      </td>
  58.     </tr>
  59.  </table> 
  60.  </body>
  61. </html>
  62.  
  63. Finally "validation.js" is as under:
  64.  
  65. function fValidateContact(form)
  66. {
  67.     if(form.emails.value == '')
  68.     {        
  69.             alert("Please enter Your Friend's Email to proceed."); form.emails.focus();
  70.     }
  71.     else if((form.emails.value.indexOf(".") == -1) || (form.emails.value.indexOf("@") == -1))
  72.     {
  73.          alert("Please enter a valid Friend's Email."); form.emails.focus();
  74.     }        
  75.     else if(form.inputDate.value == '')
  76.      {        
  77.  alert("Please choose Meeting Date from the Calendar."); form.inputDate.focus();
  78.      }
  79.     else if(form.meettime.value == '')
  80.      {
  81.  alert("Please enter Meeting Time to proceed."); form.meettime.focus();
  82.      }
  83.     else if(form.vname.value == '')
  84.     {
  85. alert("Please enter Your Name to proceed."); form.vname.focus();
  86.     }
  87.     else if(form.visitormail.value == '')
  88.     {
  89.  alert("Please enter Email Address to proceed."); form.visitormail.focus();
  90.     }
  91.     else if((form.visitormail.value.indexOf(".") == -1) || (form.visitormail.value.indexOf("@") == -1))
  92.     {
  93. alert("Please enter a valid Email Address."); form.visitormail.focus();
  94.     }
  95.     else
  96.     form.submit(); //May be this is the mistake? But what should I do then?
  97. }
[Please use CODE tags when posting source code. Thanks! --pbmods]

I don't understand why PHP is not processing the data provided especially:
$visitormail = $_POST['visitormail'];
Please help me out. Thanks.
Jun 13 '07
10 2761
Purple
404 Recognized Expert Contributor
Hi sufian,

I am really pleased you got this working.

I look forward to hearing more from you on TSDN.

Regards Purple.
Jun 14 '07 #11

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

Similar topics

0
1899
by: Ralf Hornbeck | last post by:
Hi, I have just uploaded an older PHP project I have written by myself up to my new webserver. On this server PHP is running in version 4.3.2 and this seems to result in some trouble, since the project worked out pretty fine some weeks ago under PHP 4.2.3 (I think). My suggestion is that it has to do sth. with sessionhandling, but I am not sure. I don't think that the DB connection is responsible for the problems and I
9
6796
by: Quinonez | last post by:
if i set a $_SESSION=$_POST in every page of a multiple page form how then would i call it on a later page of the same session? and also how is distigushed between pages ? should it be set up differently on each page, ive read of $_SESSION=$_POST but i cant seem to figure out how to call it back at the end of the form
3
43947
by: Robert Oschler | last post by:
I know there isn't any $_POST array in Javascript, it exists on the server side accessible from PHP and other server side scripting languages. But I knew it would let you know specifically what data I'm after. Is there any way to get the data that is POSTED to a web page from client-side Javascript? Or does only the server get access to it? I can get access to the URL/href data from the "search" property, but that's because it's part...
24
2884
by: moriman | last post by:
Hi, The script below *used* to work. I have only just set up a server, PHP etc again on my Win98 system and now it doesn't? On first loading this page, you would have $p = and the button image below it.
16
2539
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client uses IE to talk with a server. The user on the client (IE) sees an ASP net page containing a TextBox. He can write some text in this text box and push a submit button.
2
1949
by: Cerebral Believer | last post by:
Hi folks, Can anyone help me with this form: http://futurebydesign-music.com/_member/club_fbd_reg.php I have followed to coding instructions aas closely as I can, but I am getting errors about not filling in all the fields on the form correctly when I test it. Is validating a form with radio buttons difficult?
1
1420
by: Nosferatum | last post by:
I intend to upload documents (file_up), categorize them in 4 main categories (k_cat), have additional sub-categories (lec_cat) just for querying and getting sub-categorized output of the files when listed with date (dato_inn) and the submitters details "uploaded_by". But my script will not work. Anyone clever out there seeing what's wrong? This is my upload form, the script at the bottom:
6
2179
by: fpcreator2000 | last post by:
Hello everyone. I'm having problems with a page I've created that is used to insert data into a database. It uploads two files into two distinct folder, and it takes the filenames and inserts them into a MYSQL database along with other product information. Here is the entire .php file. I list it because the errors are not showing at all, and I need a fresh pair of eyes to look at it. Any answers, critisims (constructive), or other talk...
3
3556
by: arggg | last post by:
I have a form in PHP that needs to be processed by the same page. I have ajax calling the page and parsing the data however I cannot get the POST data to be sent via AJAX to the PHP Page. I found this site which gives me an idea that you need to setup the $_POST methods as what looks like a GET then you send the information to the PHP page which in turn interprets it as $_POST data. However I was wondering is there a way that without me...
0
9579
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
9416
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
10035
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
9981
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
9850
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
6662
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
5436
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3551
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2810
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.