Note that there are some explanatory texts on larger screens.

plurals
  1. PORadio Button not passing value to run certain functions
    primarykey
    data
    text
    <p>I am trying to use a radio button to distinguish which php function the user would like to run. However nothing is happening?? I think it is a small thing but I can't see where I'm going wrong. </p> <p>Submit Form <pre><code>value="&lt;?php if (isset($_GET['searchText'])) { echo($_GET['searchText']); } ?&gt;" /&gt; &lt;table width="300"&gt; &lt;tr&gt; &lt;td&gt;&lt;label&gt; &lt;input name="searchType" type="radio" value="1" id="searchType_0" checked="checked"/&gt; Aggregated&lt;/label&gt;&lt;/td&gt; &lt;td&gt;&lt;label&gt; &lt;input name="searchType" type="radio" value="2" id="searchType_1" /&gt; NonAggregated&lt;/label&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;input type="submit" value="Search!" name="submit" id="searchButton" /&gt; &lt;/form&gt; </code></pre> <p>Results Page </p> <pre><code>&lt;?php require('code.php'); $result = $_GET['searchText']; $selected_radiobtn = $_GET['searchType']; ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="content-type" content="text/html;charset=utf-8" /&gt; &lt;title&gt;Your Website&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;? if ($selected_radiobtn == '1') { query($result); } elseif($selected_radiobtn == '2') { query($result); } ?&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>code.php</p> <pre><code>$searchText=$_GET['searchText']; function query($searchText) { $searchText = bingSpellCheck($searchText); $searchText = commonPreProcessing($searchText); } function bingSpellCheck($query) { $bingArray = array(); $accountKey = '****************************************'; $ServiceRootURL = 'https://api.datamarket.azure.com/Bing/Search/'; $WebSearchURL = $ServiceRootURL.'SpellingSuggestions?$format=json&amp;Query='; $cred = sprintf('Authorization: Basic %s', base64_encode($accountKey.":".$accountKey)); $request = $WebSearchURL.'%27'.urlencode($query).'%27&amp;$top=2'; $ch = curl_init($request); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, $accountKey.":".$accountKey); curl_setopt($ch, CURLOPT_TIMEOUT, 30);//how long before time out curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);//return raw data curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);// dont verify ssl $data = curl_exec($ch); //$erno = curl_errno($ch); //$err = curl_error($ch); $js = json_decode($data); if($length = count($js-&gt;d-&gt;results)) { for($i = 0; $i &lt;= $length; $i++) { $bingArray[$i]['Value'] = $js-&gt;d-&gt;results[$i]-&gt;Value; if(isset($bingArray[$i]['Value'])) { print_r("Did You Mean ".'&lt;a href="?searchText='.$bingArray[$i]['Value'].'"&gt;'.$bingArray[$i]['Value']."&lt;/a&gt;?"); //$searchText = $bingArray[0]['Value']; return $query; } } } else { //$searchText = $query; //thesaurusPreProcessing($query); return $query; } } unction commonPreProcessing($searchText) { $punctuation = array("+",",",".","-","'","\"","&amp;","!","?",":",";","#","~","=","/","$","£","^","(",")","_","&lt;","&gt;"); $searchText = str_replace($punctuation, ' ', strtolower($searchText)); for($tokens=array(), $nextToken=strtok($searchText, ' '); $nextToken!==false; $nextToken=strtok(' ')) { if ($nextToken === 'not') { $nextToken = str_replace('not','NOT',$nextToken); } if ($nextToken === 'and') { $nextToken = str_replace('and','AND',$nextToken); } if ($nextToken === 'or') { $nextToken = str_replace('or','OR',$nextToken); } $tokens[] = $nextToken; } $array = $tokens; $searchText = implode(" ", $array); //print_r($searchText); $searchText = str_replace(" ","%20",$searchText); return $searchText; } </code></pre> <p>Any help would be much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload