+ Start a Discussion

How to prevent resubmit the form value on refresh the page


I need to prevent the form value re-submit on refresh(reload the page). I create page with validation , now i facing the problem once submit the i display the success message.When i refresh or reload the page it re-submit the page again(i put the validation duplicate check for mobile) and it shows the Error Message. How to reload the page without re-submit the form value. My code is 
// session_start() has to go right at the top, before any output!
            require_once ('soapclient/SforcePartnerClient.php');
            require_once ('soapclient/SforceEnterpriseClient.php');

		$mySforceConnection =new SforceEnterpriseClient();
		$mySforceConnection->login($username, $pwd.$st);
		//Checking no exception is thrown
	catch(Exception $e){
		echo $e;
    // On Click of the insert button
	if(@$_REQUEST['OK']) {

    //First check for validation
	if($_REQUEST['name'] == null || $_REQUEST['name'] == '') {
		echo "First Name can't be blank";	
	} else if($_REQUEST['lastName'] == null || $_REQUEST['lastName'] == '') {
		echo "Last Name can't be blank";	
	} else if($_REQUEST['mobNo'] == null || $_REQUEST['mobNo'] == '') {
		echo "Mobile Number can't be blank";	
	} else if($_REQUEST['email'] == null || $_REQUEST['email'] == '') {
		echo "Email can't be blank";	
	}else {
		// Checking no exception is iccured during login
		if($i==1) {
			 try {
			 	// Checking whether Phone number exists in salesforce or not?
				$query = "SELECT Id,LastName from Account where PersonMobilePhone='".$_REQUEST['mobNo']."'";
				$response = $mySforceConnection->query($query);
				foreach ($response->records as $record) {
				// if count is greater than 0, this means phone alredy exists
				if($count > 0) {
					echo "Mobile Number already exists";
				} else {
					$records = array();

                $records[0] = new stdclass();
                $records[0]->FirstName = $_REQUEST['name'];
                $records[0]->LastName = $_REQUEST['lastName'];
                $records[0]->PersonMobilePhone = $_REQUEST['mobNo'];
				$records[0]->CustomLandLine__c = '';
				$records[0]->City__c = 'Mumbai';
				$records[0]->Source__c = 'Database';
					$records[0]->OwnerId = '00590000002QqfJ';
					 $response = $mySforceConnection->create($records, 'Account');
					 echo '<div style=" background:#00FF00;height:25px;><font size="4"><center><b>'."Lead Inserted Successfully".'</b>  

			 } catch(Exception $e){
			 	echo $e;

		} else {
			echo "Wrong UserName, password or Security Token.";
SalesForce - PHP Integration
<body bgcolor="#CCFFFF">

<form name="form3" method="post">
<div style="background:#9999FF; color:#000000; height:30px; vertical-align:middle; font-size:22px; font-weight:bold"><center> Insert Lead</center></div><br />
<table align="center">      <tr>
                      <td><b>First Name</b></td>
                      <td><input type="text" name="name" id="name" size="25"></td>
                      <td><b>Last Name</b></td>
                      <td><input type="text" name="lastName" id="lastName" size="25"></td>
                      <td><b>Mobile No.</b></td>
                      <td><input type="text" name="mobNo" id="mobNo" size="25"></td>
                      <td><input type="text" name="email" id="email" size="25"></td>
                      <td colspan="2"><center><input type="submit" value="Insert" name="OK"></center></td>

How to do it????