Jump to content

Ashish Sood

Members
  • Posts

    79
  • Joined

  • Last visited

Posts posted by Ashish Sood

  1. Hi All,I tried to make a PHP script which used to send the mails to all the clients for the i thought first to make a dummy scirpt, But its fail during sending the mail. Below is a error messageWarning: mail(): SMTP server response: 530 5.7.1 Client was not authenticated in C:inetpubwwwrootdummyemailemail_script.php on line 10I don't know what authentication its need. Please help me to overcome from this problem.Below is my php script

    <?php$from="testturnover@abc.com";$email=$_POST['email'];$subject=$_POST['subject'];$message=$_POST['message'];mail($email, $subject, $message,"From:".$from);print "email has been sent : </br> $email</br>$subject</br>$message</br>";?>

    Is this warning appear because of wrong SMTP server address ?

  2. HI,

     

    I working on the form where i want to restrict the user to input only characters,digit, . , and white space. i want to validate 2 text field and one text area.

    if(!preg_match("/^[a-zA-Z0-9].*$/",$field1))            {                $turnmsg = "<b><font color='red'> Only letters,spaces & .  are allowed </font></b>";            }                        if(!preg_match("/^[a-z A-Z].*$/",$field2))            {                $turnmsg = "<b><font color='red'> Only letters,spaces & .  are allowed </font></b>";            }                        if(!preg_match("/^[a-z A-Z].*$/",$textarea1))            {                $turnmsg = "<b><font color='red'> Only letters,spaces & .  are allowed </font></b>";            }

    The problem is that when i applied preg_match on single field with if condition its working fine , but with the mutiple if condition its fail. any alternatives or do i needs any modificaiton into my code.

     

     

    Thanks ,

    Ashish

  3. if(isset($_POST['submit'])){	 $selectcondition = "SELECT * FROM turnovers where INCIDENTID='".$_POST['search']."'"; //Select Query Which check the date whether the checklist for the given date is exit or not.	 $check=mysql_query($selectcondition,$con);	 $fetch=mysql_fetch_assoc($check);	 $status = mysql_query("SELECT STATUS FROM turnovers where INCIDENTID='".$_POST['search']."'");	 $fetch_status=mysql_fetch_assoc($status);	  	if(!$fetch) //If checklist for the given date is not exit execute if condition{			    echo '<font color="red">';  echo "<br>";  echo "No Incident Found In The Database";  echo "<br>";			    echo "</font>";}if ($fetch_status['STATUS'] =="closed"){  echo "<table width='100%' height='10%' border='1' cellspacing='0'>			     <tr bgcolor='#3399FF'>				   <th>DATE</th>				   <th>CITY</th>				   <th>SAMPLE</th>				   <th>NAME</th>								 </tr>";  while($records = mysql_fetch_array($status))		   {  			  echo "<tr bgcolor='#009999'>";			  echo "<td>" . $records['DATE'] . " </td>";			  echo "<td>" . $records['CITY']. " </td>";			  echo "<td>" . $records['SAMPLE'] . " </td>";			  echo "<td>" . $records['NAME'] . " </td>";      } 				  echo "</table>";}   

    The First if block is executed successfully but my second if block is half executed mean only the table heading is printed on the form but the table not data. please let me know what wrong in my second if block.

  4. Hi, I added fieldsets and form tag in the table tag, and in the same page i am using Javascript DOM for adding similar element on the page and after clicking on the add button nothing is happen only the blank row is inserted..

      <script>window.onload = function (){    document.getElementById("addButton").onclick = cloneFieldSet;}var counter = 0;function cloneFieldSet (){    counter++;    var theField = document.getElementById("field");    var theClone = theField.cloneNode(true);    var elements = theClone.elements;    for (var el in elements)    {		    elements[el].name += counter.toString();    }    theClone.id += counter.toString();    theField.form.insertBefore(theClone, this);}</script>  <table width="100%" border="1">  <tr>    <th scope="col">sample1</th>    <th scope="col">sample2</th>    <th scope="col">sample3</th>    <th scope="col">sample4</th>  </tr> </table><form action="sample.php" method="post"><table width="100%" border="1"><fieldset id="field" style="border:none; padding:10px; margin:10px;"><tr >    <td width="60"><input type="text" name="sample" />  </td>	           				          <td><select name="sev[]">		    <option value="none0"></option>		    <option value="example1">example 1</option>		    <option value="example2">example 2</option>		    <option value="example3">example 3</option>		    <option value="example4">example 4</option>    </td>	           </select>      <td>  <select name="status[]">		    <option value="##"></option>		    <option value="##">example</option>		    <option value="##">example</option>		    <option value="##">example</option>		    <option value="##">example</option>		    <option value="##">example</option>		    <option value="##">example</option></td>    </select>						      <td><textarea rows="2" cols="30" name="description_tic"></textarea></td></tr></table></fieldset><input type="button" value="Add" id="addButton" /><input type="submit" value="submit" name="submit" /></form>

    I want to add filedset into my table, so every columns comes just under the table heading... Thanks

  5. Thanks for the quick response dsonesuk I tried the above code and its giving me a warning(undefined index sev) upon load the page for the first time, but when i submitting the page its print the values coz sev got the value from variable. could you please explain me how could i use this code with two files, index.php and validation.php, Please read my earlier post i had paste the code, And also please explain how could i use the mutiple value in my validation.php which come from index,php Please let me know if you dont understand

  6. When ever i try to insert data into my mysql database nothing is happen mean data is not inserting into the table.Please have a look into my code I have created a two file 1) index.php2) validation.php => This is used for validation,database connection string and mysql query [index.php]

    <?php include_once('validation.php'); ?><html><body><head><title>Unix Daily Turnover</title></head> <script>window.onload = function (){	document.getElementById("addButton").onclick = cloneFieldSet;}var counter = 0;function cloneFieldSet (){	counter++;	var theField = document.getElementById("field");	var theClone = theField.cloneNode(true);	var elements = theClone.elements;	for (var el in elements)	{			elements[el].name += counter.toString();	}	theClone.id += counter.toString();	theField.form.insertBefore(theClone, this);} </script><form action="index.php" method="post"> <fieldset id="field">	<input type="text" name="incident" />				  	<select name="sev">			<option value="none0"></option>			<option value="###">###</option>			<option value="###">###</option>			<option value="###">###</option>			<option value="###">###</option>			<option value="###">###</option>	</select>  	<select name="status">			<option value="###"></option>			<option value="###">###</option>			<option value="###">###</option>			<option value="###">###</option>			<option value="###">###</option>			<option value="###">######</option>			<option value="###">###</option>	</select>							<textarea rows="2" cols="30" name="description_tic"></textarea></fieldset><input type="button" value="Add" id="addButton" /></center><input type="submit" value="submit" id="submit" /></center></form></body></html>

    validation.php

    <?phpdate_default_timezone_set('Asia/Calcutta');$date=date("m/d/Y"); if(isset($_POST['submit'])){			  if(isset($_POST['submit']))					    include("connection.php");   $incidentid=$_POST['incident'];  $severity=$_POST['sev'];  $status =$_POST['status'];  $description_ticket=$_POST['description_tic'];   $selectcondition = "SELECT * FROM test where DATE='".$date."'";//Select Query Which fetch the DATE  $check=mysql_query($selectcondition,$con);						$fetch=mysql_num_rows($check);   if($fetch >=1)				   {		  	echo "<br><b><br><font color='grey'>NOTICE<br>TURNOVER For The Same Date Is Already Exit";	echo "<br>Please Check 'Search' Or Update 'Page'. </b></font>";     }     else  {    $sql = mysql_query("INSERT INTO test (DATE,INCIDENTID,SEVERITY,STATUS,TICKETDES) VALUES   ('$date','$incidentid','$severity','$status','$description_ticket')") or die ("Database Connection Error" .mysql_error());      if($sql)		   {  	echo "<br><b> <font color='green'>Turnover for $date Submitted Successfully</b></font>";     }   } }?>

  7. After clicking on the button nothing is happen no new fieldset is added on the page.

    <script>window.onload = function () {    document.getElementById("addButton").onclick = cloneFieldSet;}var counter = 0;function cloneFieldSet () {    counter++;    var theField = document.getElementById("field");    var theClone = theField.cloneNode(true);    var elements = theClone.elements;    for (var el in elements) {	    elements[el].name += counter.toString();    }    theClone.id += counter.toString();    theField.form.insertBefore(theClone, this);}</script><fieldset id="field">    <input type="text" name="incident" />		        <select name="sev">	    <option value="none0"></option>	    <option value="###">###</option>	    <option value="###">###</option>	    <option value="###">###</option>	    <option value="###">###</option>	    <option value="###">###</option>    </select>        <select name="status">	    <option value="###"></option>	    <option value="###">###</option>	    <option value="###">###</option>	    <option value="###">###</option>	    <option value="###">###</option>	    <option value="###">######</option>	    <option value="###">###</option>    </select>			      <textarea rows="2" cols="30" name="description_tic"></textarea></fieldset><input type="button" value="Add" id="addButton" />

  8. <button onclick="SelectCreation();">Add</button>

    <script>  function SelectCreation() { var optn, btn=document.createElement("select"), status=document.createElement("select"); btn.id="select00";status.id="select01"; document.body.appendChild(btn);document.body.appendChild(status);  var SelectOptions = [['0','Select Option'],['1','option1'],['2','option2'],['3','option3'],['4','option4'],['5','option5'],['6','option6']]; var option_status = [["",'--Select Status--'],	[11,'op1'],	[12,'op2'],	[13,'op3'],	[14,'op4'],	[15,'op5']];  var currentSel = document.getElementById(btn.id); 		for (i = 0; i < SelectOptions.length; i++)			{			 optn = document.createElement("OPTION");		  				optn.text = SelectOptions[i][1];				optn.value = SelectOptions[i][0];				currentSel.options.add(optn); 			} currentSel = document.getElementById(status.id); 		for (i = 0; i < option_status.length; i++)			{			optn = document.createElement("OPTION");		  				optn.text = option_status[i][1];				optn.value = option_status[i][0];				currentSel.options.add(optn); 			}	    }  window.onload=function(){ SelectCreation();}

    One more thing that after clicking on the add button the existing dropdown list is incremented with the same option value

  9. After removing the last ',' is still adding the option element in the existing dropdown list dropdown list, please let me know where i am wrong

    var btn=document.createElement("select");btn.id="select00";document.body.appendChild(btn);var SelectOptions = [["",'--Select Option--'],[1,'option1'],[2,'option2'],[3,'option3'],[4,'option4'],[5,'option5'],[6,'option6']];var currentSel = document.getElementById(btn.id);	    for (i = 0; i < SelectOptions.length; ++i)		    {		    var optn = document.createElement("OPTION");		   			    optn.text = SelectOptions[i][1];			    optn.value = SelectOptions[i][0];			    currentSel.options.add(optn);		    }

  10. Thanks for the reply dsonesuk Whenever i calls the function add(); its increment the existing dropdownlist with the existing options, but i want a new dropdown list with the options each time whenever i call the function. New dropdown list should be created in the new line ...

×
×
  • Create New...