when i pass array how can i get input value

when i pass array how can i get input value in php

$value1=$resultpackages['Package_Price'];
                    $value2=$resultmarkup['markup'];
                    $value3=($value1*$value2)/100;
                    $value4=$value1+$value3;
                    $downname1=$_POST['downloadname'];

                    $priceid=$resultpackages['package_id'];
                    $pricevalue=$value4;
                    $price = array("$priceid","$value2","$value3","$pricevalue","$downname1");

                    $TP = json_encode($price);
                    $RequestTP = urlencode($TP);

Open in new window


the problem is downname1 is empty how i can do
AHMED SAMYownerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
the problem is downname1 is empty how i can do
What are you expecting to be?
Where is your form code?

Your question is not clear - can you clarify what you are wanting?
0
AHMED SAMYownerAuthor Commented:
i am trying to export php to word and there is images and some inputs need to take it's values

i make it in a separate page it is working but inputs value is empty

and images not appears

this is the code in the first page :

<div id="Download" class="hide  breadcrumb">
				
        	<div class="col-lg-12">
                <p style="color:#F00">Ti consigliamo di impostare il markup standard per un livello di maturità più elevato.</p>
				<div class="float-left col-lg-6">
                    nome del cliente :

                    <?php
                    $user=$_SESSION['username'];
                    $sqlmarkup="SELECT markup FROM markup WHERE user_name='$user'";
                    $querymarkup=mysqli_query($connect,$sqlmarkup);
                    $resultmarkup=mysqli_fetch_array($querymarkup);

                    $value1=$resultpackages['Package_Price'];
                    $value2=$resultmarkup['markup'];
                    $value3=($value1*$value2)/100;
                    $value4=$value1+$value3;
                    $downname1=$_POST['downloadname'];

                    $priceid=$resultpackages['package_id'];
                    $pricevalue=$value4;
                    $price = array("$priceid","$value2","$value3","$pricevalue","$downname1");

                    $TP = json_encode($price);
                    $RequestTP = urlencode($TP);
                    ?>
                    <input type="text" name="downloadname" placeholder="client name" class="form-control" >
					<br>

                    Scarica il tipo:

                    <a href="hi.php?wordText=<?php echo $RequestTP; ?>" class="btn btn-primary">word</a>

                    <br>
					<br>

                    <p>Il tuo markup: <input type="text" id="markup" name="markup" value="<?php echo $value2; ?>" disabled/></p>
                    <br>

                </div>

Open in new window


export page is
$TP = urldecode($_REQUEST['wordText']);
    $Mixed = json_decode($TP);
    $id=$Mixed[0];
    $value2=$Mixed[1];
    $value3=$Mixed[2];
    $pricevalue=$Mixed[3];


    $sqlpackages="SELECT * FROM packages WHERE package_id='$id' ";
    $querypackages=mysqli_query($connect,$sqlpackages);
    $resultpackages=mysqli_fetch_array($querypackages);

    $name=$_SESSION['username'];
    $sqlname="SELECT * FROM users WHERE user_name='$name' ";
    $queryname=mysqli_query($connect,$sqlname);
    $resultname=mysqli_fetch_array($queryname);

    $name=$_SESSION['username'];
    $today=date("d/m/y");
    $travel=$resultpackages['valid_date'];
    $trip=$resultpackages['Trip_Duration'];
    $price=$resultpackages['Package_Price'];
    $client=$Mixed[4];

    $download_sql="INSERT INTO download(Downloads,Travel_Date,Trip,Markup,Net,Markup_Price,Sale,Reference,user_name) VALUES('$today','$travel','$trip','$value2','$price','$value3','$pricevalue','$downname','$name')";
    $downquery=mysqli_query($connect,$download_sql);


    header("cotent-type:application/vnd.msword");

    $filname="package.doc";
    header("content-disposition:attachment;filename=".$filname);

Open in new window

0
AHMED SAMYownerAuthor Commented:
if there is simple way to export data from form to word please help
i tried many ways useless
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Julian HansenCommented:
Where is package.doc coming from?
0
AHMED SAMYownerAuthor Commented:
from database and i bring some data pass in array
0
Julian HansenCommented:
You want to know about this
$downname1=$_POST['downloadname'];

Open in new window

Which implies somewhere you have a form or a script that is posting to this script.

Where are you doing the post - where is the code that is doing that?
0
AHMED SAMYownerAuthor Commented:
exactly what i mean i will make some inputs and will take this all values to another page to print it or export it
first is page you give inputs
export page is taking values to export word
0
Julian HansenCommented:
There are many things I don't understand here
The code you posted - there is no <form> tag
You have lines like this
$value1=$resultpackages['Package_Price'];

Open in new window

$resultpackages is not defined anywhere.

To help you I need something to work with.

Your question is
the problem is downname1 is empty how i can do
This comes from this form element
<input type="text" name="downloadname" placeholder="client name" class="form-control" >

Open in new window


So without seeing the rest of your code I am going to say it is empty because
Either you are not setting your <form method="POST" ...> and the value is not being POSTED
OR
You are not entering a value for that control

I can't help anymore until you give me more information.

Start with posting your full <form> code - not just a bit of it.
0
AHMED SAMYownerAuthor Commented:
first

$sqlpackages="SELECT * FROM packages WHERE package_id='$id' ";
    $querypackages=mysqli_query($connect,$sqlpackages);
    $resultpackages=mysqli_fetch_array($querypackages);

second

<form action="<?php echo $PHP_SELF; ?>" method="post">
0
Julian HansenCommented:
$sqlpackages="SELECT * FROM packages WHERE package_id='$id' ";
    $querypackages=mysqli_query($connect,$sqlpackages);
    $resultpackages=mysqli_fetch_array($querypackages);

Open in new window

This comes from the export page.
The first page uses $resultpackages as well - that is what I was referring to.

Chang your <form> to point to this script
reflect.php
<?php
echo "<pre>";
print_r($_POST);
print_r($_GET);
echo "</pre>";
?>

Open in new window

And post the results here.
0
AHMED SAMYownerAuthor Commented:
change first or second page
<form>
0
Julian HansenCommented:
I don't understand? You have a form that is posting to a page?

Change the form's action to be the script I posted above - this is called a reflection script - it shows us what was entered into the form.

Your question is why certain information is not being posted by the form. To do that we need to break the process down into

1. What the form sends - is it sending what we think it is
2. What the receiving script is receiving.
0
AHMED SAMYownerAuthor Commented:
Array
(
    [cust_date] => 01/02/2018
    [Duration] => 10 Notti / 11 Giorni
    [cust_rooms] => 4
    [carused] => Toyota Hiace
    [meal] => Breakfast
    [cust_clientname] => 54545
    [category] => Hilton Marsa Alam Nubian Resort
    [cust_Comment] => per 4545scrivi qui
    [customize] => personalizzare
    [book_date] =>
    [clientname] =>
    [rooms] => 0
    [children] => 0
    [agechildren] => 0
    [comment] => per favore scrivi qui....
    [clientsave] =>
)
Array
(
)
0
AHMED SAMYownerAuthor Commented:
thanks and forgive me for disturbing
0
Julian HansenCommented:
Where is downname1 in that list?

What this is telling me is that there is no control in your form called downname1.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AHMED SAMYownerAuthor Commented:
you are right
i changed many times because that time i make this job no body support
let me change and see result
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.