AHMED SAMY
asked on
when i pass array how can i get input value
when i pass array how can i get input value in php
the problem is downname1 is empty how i can do
$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);
the problem is downname1 is empty how i can do
ASKER
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 :
export page is
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>
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);
ASKER
if there is simple way to export data from form to word please help
i tried many ways useless
i tried many ways useless
Where is package.doc coming from?
ASKER
from database and i bring some data pass in array
You want to know about this
Where are you doing the post - where is the code that is doing that?
$downname1=$_POST['downloadname'];
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?
ASKER
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
first is page you give inputs
export page is taking values to export word
There are many things I don't understand here
The code you posted - there is no <form> tag
You have lines like this
To help you I need something to work with.
Your question is
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.
The code you posted - there is no <form> tag
You have lines like this
$value1=$resultpackages['Package_Price'];
$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 doThis comes from this form element
<input type="text" name="downloadname" placeholder="client name" class="form-control" >
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.
ASKER
first
$sqlpackages="SELECT * FROM packages WHERE package_id='$id' ";
$querypackages=mysqli_quer y($connect ,$sqlpacka ges);
$resultpackages=mysqli_fet ch_array($ querypacka ges);
second
<form action="<?php echo $PHP_SELF; ?>" method="post">
$sqlpackages="SELECT * FROM packages WHERE package_id='$id' ";
$querypackages=mysqli_quer
$resultpackages=mysqli_fet
second
<form action="<?php echo $PHP_SELF; ?>" method="post">
$sqlpackages="SELECT * FROM packages WHERE package_id='$id' ";
$querypackages=mysqli_query($connect,$sqlpackages);
$resultpackages=mysqli_fetch_array($querypackages);
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>";
?>
And post the results here.
ASKER
change first or second page
<form>
<form>
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.
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.
ASKER
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
(
)
(
[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
(
)
ASKER
thanks and forgive me for disturbing
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
you are right
i changed many times because that time i make this job no body support
let me change and see result
i changed many times because that time i make this job no body support
let me change and see result
Where is your form code?
Your question is not clear - can you clarify what you are wanting?