Get a reference that went on this page [closed] - php

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I need to get a reference that went on this page and then send it on the server.
I tried to add this field in my form
<input type="hidden" id="refferer_url" name="refferer_url" value="<?php $_SERVER['HTTP_REFERER'] ?>">
but I get nothing, when I try to go to my page from other pages using link, value of this input is empty.
What's wrong?

<input type="hidden" id="refferer_url" name="refferer_url" value="<?php $_SERVER['HTTP_REFERER'] ?>">
Echo it :
//here
<input type="hidden" id="refferer_url" name="refferer_url" value="<?php echo $_SERVER['HTTP_REFERER'] ?>">

Related

PHP Syntax error unexpected ending while using if-else in input tag [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I'm getting syntax error when i use if-else inside form <input tag using php to change Value
<input type="text" name="ecsname" class="form-control"
<?php if(empty($_GET['id'])){?>
value="" <?php}else{?>
value="<?php echo $res->cshort;?>"
<?php}?>
>
You can clean up your existing code so it's much nicer to read and also separates out the logic from the output.
<?php $ecsname_value = empty($_GET['id'])?"":$res->cshort;?>
<input type="text" name="ecsname" class="form-control" value="<?=$ecsname_value;?>">
<?php $ecsname_value = empty($_GET['id'])?"":$res->cshort;?> is a shorter version of your if/else using the ternary operator.
This assumes that $res->cshort is defined somewhere.

isset($_POST['submit']) not being triggered on button click [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
The below code should echo when a user clicks on "more". I can't see the issue with the below code, so any assistance will be much appreciated.
if (isset($_POST['more'])){
echo <<<saveNewFactor
<input type="text" size="29">
saveNewFactor;
}
echo <<<saveNewFactor
</br>
<input type="submit" neme="more" value="more" class="forming7">
saveNewFactor;
In your HTML:
<input type="submit" neme="more" value="more" class="forming7">
You have spelt name as neme, change it to:
<input type="submit" name="more" value="more" class="forming7">

HTML form not sending data via $_POST [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I have been trying to send some basic form information from my index page to a .php page without success. I have tweaked my code looking at the previously asked questions but to no avail.
I have another form on the same page which sends information to another .php page which works without flaw.
My form page code:
<form name="login" action="login.php" method="post">
<p>email: <input type="text" name="loginEmail"></p><br>
<p>password: <input type="password" name="loginPass"></p>
<button type="submit"> Submit!</button>
</form>
my login.php page code:
<?php
echo "test";
$email=$POST_["loginEmail"];
echo $email;
?>
All I see on my login.php page is "test".
Thanks.
Switching the location of the _ should do it:
<?php
echo "test";
$email=$_POST["loginEmail"];
echo $email;
?>

jQuery Select Failed To Change Input Value [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I have this jquery inside PHP code :
echo '<select id="state" name="state" onchange="document.getElementById(\'state_text_content\').value=this.options[this.selectedIndex].text>
'.$list_state.'
</select>
<input type="hidden" name="state_text" id="state_text_content" value="" />';
why onchange function doesn't update #state_text_content value? thank you.
echo '<select id="state" name="state" onchange="document.getElementById(\'state_text_content\').value=this.options[this.selectedIndex].text">
'.$list_state.'
</select>
<input type="hidden" name="state_text" id="state_text_content" value="" />';
Without seeing everything, I think it's because you have a typo. There is a missing quote at the end of the onchange=""

php tags not working. what is diference between php tags <php and <? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
First code is fine but textfield give back all php tag
<td><?php print($code_verification);?>
<input type="text" name="packaging_code" id="packaging_code" value="<?=$code_verification?>" />
Change:
value="<?=$code_verification?>"
to:
value="<?php echo $code_verification; ?>"
The first line would work if your server had short_open_tags enabled.
your first code will work if you enable short tags.otherwise you can try below code
<input type="text" name="packaging_code" id="packaging_code" value="<?php echo $code_verification; ?>" />

Categories