Hello,
I'm running a PTC website in which I'm unable to edit the referral field.

Here is the code:

Referrer (if any):<br>
<input type="text" size="25" maxlength="15" name="referer" class="form" autocomplete="off" value="<? if($_POST["referer"]) { print $_POST["referer"]; } else { echo securedata($_GET["r"]); } if($_POST['referer'] or $_GET['r']) { print "\" readonly disabled"; } ?>">

After session_start() function, this is the code written as well;

session_start();

if($_GET['r'] and !$_SESSION['r']) { $_SESSION['r'] = $_GET['r']; }
if(($_SESSION['r'] and !$_GET['r']) or (($_SESSION['r'] and $_GET['r']) and $_GET['r'] != $_SESSION['r'])) { $_GET['r'] = $_SESSION['r']; }

I tried different ways but unable to do what I want to.

Kindly someone give me the solution.

Hello,
I'm running a PTC website in which I'm unable to edit the referral field.

Here is the code:

Referrer (if any):<br>
<input type="text" size="25" maxlength="15" name="referer" class="form" autocomplete="off" value="<? if($_POST["referer"]) { print $_POST["referer"]; } else { echo securedata($_GET["r"]); } if($_POST['referer'] or $_GET['r']) { print "\" readonly disabled"; } ?>">

After session_start() function, this is the code written as well;

session_start();

if($_GET['r'] and !$_SESSION['r']) { $_SESSION['r'] = $_GET['r']; }
if(($_SESSION['r'] and !$_GET['r']) or (($_SESSION['r'] and $_GET['r']) and $_GET['r'] != $_SESSION['r'])) { $_GET['r'] = $_SESSION['r']; }

I tried different ways but unable to do what I want to.

Kindly someone give me the solution.

I'm not sure I understand your question, but the first thing that pops out here is the use of double-quotes within your value parameter. The first PHP double-quote is going to close your "value" double-quote and destroy your code logic. Change the PHP quotes to single-quotes or escape them to avoid this bug.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.