lundi 21 mai 2018

How to get the data after submit the form based on the form input value using laravel

My controller contain single function with multiple API calling when I returned the controller function to my view api data displayed automatically but i need to display the data while submit the form. Please suggest any solution.

My Controller Code

public function domaincheck(Request $request)
{
ini_set('max_execution_time', 300);
<!-- Domain Availability Check -->
    $sld = $request['sld'];
    $tld = $request['tld'];
    $response = file_get_contents('https://resellertest.enom.com/interface.asp?command=check&sld='. $sld .'&tld='. $tld .'&uid=resellid&pw=resellpw&responsetype=xml');  
    $data = simplexml_load_string($response);
    $configdata   = json_encode($data);
    $final_data = json_decode($configdata,true);

 <!--Domain Name Suggestions --> 
  $response1 = file_get_contents('http://resellertest.enom.com/interface.asp?command=GETNAMESUGGESTIONS&uid=resellid&pw=resellpw&SearchTerm='. $sld .'&MaxResults=5&ResponseType=XML');       
    $data1 = simplexml_load_string($response1);
    $configdata1   = json_encode($data1);
    $final_data1 = json_decode($configdata1,true);
}

My view Code

 <form class="form-horizontal" method="get"> 
  <div class="form-group">
     <div class=" col-lg-2"></div>
     <div class="col-lg-8">
         <div class="input-group m-b">
            <span class="input-group-addon" style="padding-left:10px; background-color: #999;" class='unclickable'>www</span>
            <input type="text" name="sld" class="form-control">
  <span class="input-group-addon">
  <select class="form-control" name="tld" style="width: 100px;">
 <?php $j = 0; ?>
  @foreach($final_data2['tldlist']['tld'] as $value)
  <?php $j++; ?> 
  @endforeach
  @for ($i = 0; $i < $j-1;)
  <option value=""></option>
  <?php $i++; ?> 
  @endfor
      </select>  
      </span>
      <span class="input-group-addon">
      <button type="submit" class="btn btn-sm btn-success">Submit</button>  
      </span>
      </div>
                <p class="text-center text-dark customFont" >
                    @foreach($final_data as $key=>$value)
                      @if($key=='DomainName')
                        <b></b> <b>-</b>
                      @endif 
                      @if($key=='RRPText')
                          <b></b>
                      @endif
                    @endforeach
                </p>

         

When submit the form (Response) it shows the domain name is available or not available. Response1 is shows the domain name suggestions but it shows the data with out submit the form.Please suggest any solutions



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ICESec
via IFTTT

Aucun commentaire:

Enregistrer un commentaire