Web lists-archives.com

RE: how to insert PHP into confirrmation page




Dear Jeffry

Thank you for your effort. I am going to use confirmation page in the website which somebody created. 
The point is that confirmation page below (partly, not all) should be used. So some PHP program will be inserted into it.
I hope you help me.

Hori
----------
[confirmation page, by php]

function confirmOutput($arr){
global $hankaku,$hankaku_array;
$html = '';
foreach($arr as $key => $val) {
$out = '';   
if(is_array($val)){

foreach($val as $key02 => $item){

if(is_array($item)){
      $out .= connect2val($item);
     }else{
      $out .= $item . ', ';
      }
  }
  $out = rtrim($out,', ');
}else{ $out = $val; }
if(get_magic_quotes_gpc()) { $out = stripslashes($out); } $out = 
nl2br(h($out));
$key = h($key);        

-----Original Message-----
From: Jeffry Killen [mailto:jekillen@xxxxxxxxxxx] 
Sent: Tuesday, October 02, 2018 2:45 AM
To: sh
Cc: php-general General List
Subject: Re: how to insert PHP into confirrmation page

Where does the form page submit to? The form page of the confirmation page?
The form action attribute should point to the confirmation page, where the word
count should be determined. 

In the confirmation page:
<?php
$wordCount = "";
if($_POST['sentence'])
  {
  $wordCount = str_word_count($_POST["sentence"])
  }
?>

Now, wherever the word count is suppose to appear in confirmation page:

>>> <?php print $wordCount; ?>


JK

> On Oct 1, 2018, at 4:51 AM, sh <hosayuki@xxxxxxxxx> wrote:
> 
>> Do you mean PHP code is being shown to HTML client?
> When extension of the form page is [.html] PHP code is being shown in texarea.
> When extension of the form page is [.PHP] PHP code is not shown in texarea. But result does not appear in confirmation page.
> 
> Hori
> -----Original Message-----
> From: Narcis Garcia [mailto:informatica@xxxxxxxxx] 
> Sent: Monday, October 01, 2018 8:05 PM
> To: php-general@xxxxxxxxxxxxx
> Subject: Re: how to insert PHP into confirrmation page
> 
> Do you mean PHP code is being shown to HTML client?
> 
> 
> El 01/10/18 a les 11:32, sh ha escrit:
>> >Is that page really working as a PHP file?
>> I changed html extension to PHP extension. 
>> But word count does not appear in confirmation page. It appears in the form page.
>> 
>> Hori 
>> 
>> -----Original Message-----
>> From: Narcis Garcia [mailto:informatica@xxxxxxxxx] 
>> Sent: Monday, October 01, 2018 3:51 PM
>> To: php-general@xxxxxxxxxxxxx
>> Subject: Re: how to insert PHP into confirrmation page
>> 
>> Is that page really working as a PHP file?
>> Your last comment seems to indicate a static HTML file.
>> 
>> 
>> El 01/10/18 a les 06:18, sh ha escrit:
>>> Dear Jeffry Killen
>>> 
>>> Thank you for your mail. I tried as you tell.
>>> But I cannot get word count in confirmation page.  
>>> <?php print str_word_count($_POST["sentence"]) ?> appears in textarea in form page.
>>> 
>>> Saneyuki Hori
>>> 
>>> -----Original Message-----
>>> From: Jeffry Killen [mailto:jekillen@xxxxxxxxxxx] 
>>> Sent: Monday, October 01, 2018 12:20 PM
>>> To: sh
>>> Cc: php-general General List
>>> Subject: Re: how to insert PHP into confirrmation page
>>> 
>>> 
>>>> On Sep 30, 2018, at 7:42 PM, sh <hosayuki@xxxxxxxxx> wrote:
>>>> 
>>>> Hello
>>>> I am a new member. I have a question about form page and confirmation page.
>>>> The question is how to get word count in confirmation page from form page by PHP. The program is as below which is part of whole page.  
>>>> 
>>>> Function of getting word count is:  str_word_count($_POST["sentence"]
>>>> I am waiting for fast answer from a member. 
>>>> 
>>>> [form page, by html]
>>>> <form name="namae" method="post" action="2contact_mail.php">
>>>>    <table class="formTable">
>>>>     <tr>
>>>>      <th>language combination</th>
>>>>    <td><select name=" language combination ">
>>>>      <option value="" selected> ----</option>
>>>>      <option value="japanese→english">  japanese→english </option>
>>>>      <option value=" english→japanese ">  english→japanese </option>    
>>>>     </select></td>
>>>>    <td><input size="30" type="hidden" name="word_count" /></td>
>>>>     </tr>
>>>>      <tr>
>>>>        <th> sentence </th>
>>>>       <td><textarea name="sentence" rows="4" cols="40"><?php print str_word_count($_POST["sentence"]) ?></textarea></td></tr>
>>>>       </table> 
>>>> 
>>>> [confirmation page, by php]
>>>> 
>>>> function confirmOutput($arr){
>>>> global $hankaku,$hankaku_array;
>>>> $html = '';
>>>> foreach($arr as $key => $val) {
>>>> $out = '';   
>>>> if(is_array($val)){ 
>>>> 
>>>> foreach($val as $key02 => $item){ 
>>>> 
>>>> if(is_array($item)){
>>>>      $out .= connect2val($item);
>>>>      }else{
>>>>      $out .= $item . ', ';
>>>>      }
>>>>  }
>>>>  $out = rtrim($out,', ');
>>>> }else{ $out = $val; }
>>>> if(get_magic_quotes_gpc()) { $out = stripslashes($out); }  
>>>> $out = nl2br(h($out)); 
>>>> $key = h($key);        
>>>> ------
>>>> I tried as follows:
>>>>  I added: 
>>>>      $out .= str_word_count($_POST["sentence"]).;
>>>>  Above 
>>>>     $out = nl2br(h($out));
>>>> 
>>>> But in all columns word count was added. I need word count only in textarea.
>>>> 
>>>> 
>>>> Saneyuki Hori
>>> 
>>> This may not be exactly what you are looking for but the simplest approach I know
>>> of is:
>>>> <td><textarea name="sentence" rows="4" cols="40"><?php print str_word_count($_POST["sentence"]) ?></textarea></td></tr>
>>> 
>>> JK
>>> 
>>> 
>> 
>