Note that there are some explanatory texts on larger screens.

plurals
  1. POpassing and receiving string variables using php
    primarykey
    data
    text
    <p>I am passing the string value through link in the URL to the next page like this <code>&lt;a href="ApplicationRegister.php?plan=trial"&gt;</code> In the ApplicationRegister.php page, i am getting this value like this <code>$plan = $_GET["plan"];</code> and i will put this into a session variable like this <code>$_SESSION['plans'] = $plan;</code> Here i am getting the value. but after the if statement i am not getting the value for this plan even after using Session variable. </p> <p>My complete code is like this</p> <pre><code> $plan = $_GET["plan"]; echo $plan; $_SESSION['plan'] = $plan; $plans = $_SESSION['plan']; echo $_SESSION['plans']; include('connect.php'); If (isset($_POST['submit'])) { $CompanyName = $_POST['CompanyName']; $CompanyEmail = $_POST['CompanyEmail']; $CompanyContact = $_POST['CompanyContact']; $CompanyAddress = $_POST['CompanyAddress']; $StoreName = $_POST['StoreName']; echo $plans; $myURL ="$_SERVER[HTTP_HOST]"; $myURL =$StoreName.'.'.$myURL; if (stripos($myURL, 'www.') !== 0) { $myURL = 'www.' . $myURL; } if (stripos($myURL, 'http://') !== 0) { $myURL = 'http://' .$myURL; } if(stripos($myURL, '.com') !== 0) { $myURL = $myURL . '.com'; } echo $plans; $RegistrationType = $_POST['RegistrationType']; $Status = "Active"; $sql = "select * from plans where planname = '$plans'"; echo $sql; mysql_query($sql) or die (mysql_error()); $planID = $row['planid']; $query1 = "select count(CompanyEmail) from ApplicationRegister where CompanyEmail = '$CompanyEmail'" ; $result1 = mysql_query($query1) or die ("ERROR: " . mysql_error()); $msg = ""; while ($row = mysql_fetch_array($result1)) { if($row['count(CompanyEmail)'] &gt; 0) { $msg = "&lt;font color='red'&gt; &lt;b&gt;This E-mail id is already registered &lt;/b&gt;&lt;/font&gt; "; break; } } if($msg == "") { $query2 = "select count(URL) from ApplicationRegister where URL = '$myURL' "; $result2 = mysql_query($query2) or die ("ERROR: " . mysql_error()); $msg = ""; while ($row = mysql_fetch_array($result2)) { if($row['count(URL)'] &gt; 0) { $msg = "&lt;font color='red'&gt; &lt;b&gt;This Stroename is already registered &lt;/b&gt;&lt;/font&gt; "; break; } } if($msg == "") { $sql = "INSERT INTO ApplicationRegister(planid, CompanyName, CompanyEmail, CompanyContact, CompanyAddress, RegistrationType, ApplicationPlan, ApplicationStatus, URL, CreatedDate) VALUES ('$planID', '$CompanyName', '$CompanyEmail', '$CompanyContact', '$CompanyAddress', '$RegistrationType', '$plans', '$Status', '$myURL', NOW() )"; mysql_query($sql) or die(mysql_error()); $id = mysql_insert_id(); $_SESSION['application_id'] = $id; if($plans == "trail") { header("Location: userRegister.php"); exit(); } else { header("Location : PaymentGateway.php"); exit(); } } } } ?&gt; </code></pre> <p>Only in the beginning it holds the value , if i try to display it within theIf <code>(isset($_POST['submit']))</code> it shows blank value for plans. Do not know what to do. Plz suggest </p> <p><strong>EDITED</strong> Even after using like this, its the same. i do not know what may be the problem :( <pre><code> $plan = $_GET["plan"]; echo $plan; $_SESSION['plans'] = $plans; echo $_SESSION['plans']; // $plan = +$plan; include('connect.php'); If (isset($_POST['submit'])) { $CompanyName = $_POST['CompanyName']; $CompanyEmail = $_POST['CompanyEmail']; $CompanyContact = $_POST['CompanyContact']; $CompanyAddress = $_POST['CompanyAddress']; $StoreName = $_POST['StoreName']; echo $_SESSION['plans']; </code></pre> <p><strong>EDITED</strong></p> <p>In ApplicationRegister.php, i have passed the hiddenvalue which i got fro\m previous page like this</p> <pre><code>&lt;input type="hidden" name="plan" value="&lt;?php echo $plan ?&gt;"/&gt; </code></pre> <p>then POST method i have used this. Now i am getting the value for it. Thanks to all</p> <p><strong>EDITED</strong></p> <pre><code>if($PlanName == "trail") { header("Location: userRegister.php"); exit(); } else { header("Location : PaymentGateway.php"); exit(); } </code></pre>
    singulars
    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