PHP form handling, dataload
My main objective is loading the price(monto) when the product and the payment method is selected(Criterio de Cobro).
This by using a query, I can't find how to put product and payment method variables for making the query of the final price.
<label>Producto</label>
<select name="id_producto" class="input_form" id="idCategoriaProducto">
<option value="" selected="selected">Seleccione...</option>
<?php
$q = mysql_query("SELECT id AS idProducto, titulo AS tituloProducto
FROM productos WHERE operando = 1
ORDER BY CAST(SUBSTRING_INDEX(titulo, '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(titulo, '.', -2), '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(titulo, '.', -1) AS UNSIGNED) ASC");
while($r = mysql_fetch_array($q)){
extract($r);
?>
<option value="<?= $idProducto; ?>"
<?php
if($id_producto == $idProducto){
echo"selected='selected'";
} ?>
><?= $tituloProducto ?>
</option>
<?php
}
?>
</select>
<label>Criterio de Cobro</label>
<select name="tipo_cobro" class="input_form" required="required">
<option value="0" <?php if($tipo_cobro == "0"){echo"selected='selected'";} ?>>Seleccione...</option>
<option value="1" <?php if($tipo_cobro == "1"){echo"selected='selected'";} ?>>Fijo</option>
<option value="2" <?php if($tipo_cobro == "2"){echo"selected='selected'";} ?>>Por Hora</option>
<option value="3" <?php if($tipo_cobro == "3"){echo"selected='selected'";} ?>>Otro</option>
</select>
<div class="clear10"></div>
<label>Monto</label>
<input type="text" name="monto" class="input_form" value="<?= $monto; ?>" >
<div class="clear10"></div>php mysql
add a comment |
My main objective is loading the price(monto) when the product and the payment method is selected(Criterio de Cobro).
This by using a query, I can't find how to put product and payment method variables for making the query of the final price.
<label>Producto</label>
<select name="id_producto" class="input_form" id="idCategoriaProducto">
<option value="" selected="selected">Seleccione...</option>
<?php
$q = mysql_query("SELECT id AS idProducto, titulo AS tituloProducto
FROM productos WHERE operando = 1
ORDER BY CAST(SUBSTRING_INDEX(titulo, '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(titulo, '.', -2), '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(titulo, '.', -1) AS UNSIGNED) ASC");
while($r = mysql_fetch_array($q)){
extract($r);
?>
<option value="<?= $idProducto; ?>"
<?php
if($id_producto == $idProducto){
echo"selected='selected'";
} ?>
><?= $tituloProducto ?>
</option>
<?php
}
?>
</select>
<label>Criterio de Cobro</label>
<select name="tipo_cobro" class="input_form" required="required">
<option value="0" <?php if($tipo_cobro == "0"){echo"selected='selected'";} ?>>Seleccione...</option>
<option value="1" <?php if($tipo_cobro == "1"){echo"selected='selected'";} ?>>Fijo</option>
<option value="2" <?php if($tipo_cobro == "2"){echo"selected='selected'";} ?>>Por Hora</option>
<option value="3" <?php if($tipo_cobro == "3"){echo"selected='selected'";} ?>>Otro</option>
</select>
<div class="clear10"></div>
<label>Monto</label>
<input type="text" name="monto" class="input_form" value="<?= $monto; ?>" >
<div class="clear10"></div>php mysql
php is a server code, you can't expect to make a single change and expect it to update the results. all the inline php will occur before the page loads
– comphonia
Nov 14 '18 at 2:58
but if i load the price and just filter it after the selection of both fields i believe it could happen
– Luis Doriz
Nov 14 '18 at 3:18
yes. if you plan on setting or passing the variable to the page before it loads. Is your price supposed to go in the query? I don't see it anywhere.
– comphonia
Nov 14 '18 at 3:25
add a comment |
My main objective is loading the price(monto) when the product and the payment method is selected(Criterio de Cobro).
This by using a query, I can't find how to put product and payment method variables for making the query of the final price.
<label>Producto</label>
<select name="id_producto" class="input_form" id="idCategoriaProducto">
<option value="" selected="selected">Seleccione...</option>
<?php
$q = mysql_query("SELECT id AS idProducto, titulo AS tituloProducto
FROM productos WHERE operando = 1
ORDER BY CAST(SUBSTRING_INDEX(titulo, '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(titulo, '.', -2), '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(titulo, '.', -1) AS UNSIGNED) ASC");
while($r = mysql_fetch_array($q)){
extract($r);
?>
<option value="<?= $idProducto; ?>"
<?php
if($id_producto == $idProducto){
echo"selected='selected'";
} ?>
><?= $tituloProducto ?>
</option>
<?php
}
?>
</select>
<label>Criterio de Cobro</label>
<select name="tipo_cobro" class="input_form" required="required">
<option value="0" <?php if($tipo_cobro == "0"){echo"selected='selected'";} ?>>Seleccione...</option>
<option value="1" <?php if($tipo_cobro == "1"){echo"selected='selected'";} ?>>Fijo</option>
<option value="2" <?php if($tipo_cobro == "2"){echo"selected='selected'";} ?>>Por Hora</option>
<option value="3" <?php if($tipo_cobro == "3"){echo"selected='selected'";} ?>>Otro</option>
</select>
<div class="clear10"></div>
<label>Monto</label>
<input type="text" name="monto" class="input_form" value="<?= $monto; ?>" >
<div class="clear10"></div>php mysql
My main objective is loading the price(monto) when the product and the payment method is selected(Criterio de Cobro).
This by using a query, I can't find how to put product and payment method variables for making the query of the final price.
<label>Producto</label>
<select name="id_producto" class="input_form" id="idCategoriaProducto">
<option value="" selected="selected">Seleccione...</option>
<?php
$q = mysql_query("SELECT id AS idProducto, titulo AS tituloProducto
FROM productos WHERE operando = 1
ORDER BY CAST(SUBSTRING_INDEX(titulo, '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(titulo, '.', -2), '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(titulo, '.', -1) AS UNSIGNED) ASC");
while($r = mysql_fetch_array($q)){
extract($r);
?>
<option value="<?= $idProducto; ?>"
<?php
if($id_producto == $idProducto){
echo"selected='selected'";
} ?>
><?= $tituloProducto ?>
</option>
<?php
}
?>
</select>
<label>Criterio de Cobro</label>
<select name="tipo_cobro" class="input_form" required="required">
<option value="0" <?php if($tipo_cobro == "0"){echo"selected='selected'";} ?>>Seleccione...</option>
<option value="1" <?php if($tipo_cobro == "1"){echo"selected='selected'";} ?>>Fijo</option>
<option value="2" <?php if($tipo_cobro == "2"){echo"selected='selected'";} ?>>Por Hora</option>
<option value="3" <?php if($tipo_cobro == "3"){echo"selected='selected'";} ?>>Otro</option>
</select>
<div class="clear10"></div>
<label>Monto</label>
<input type="text" name="monto" class="input_form" value="<?= $monto; ?>" >
<div class="clear10"></div><label>Producto</label>
<select name="id_producto" class="input_form" id="idCategoriaProducto">
<option value="" selected="selected">Seleccione...</option>
<?php
$q = mysql_query("SELECT id AS idProducto, titulo AS tituloProducto
FROM productos WHERE operando = 1
ORDER BY CAST(SUBSTRING_INDEX(titulo, '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(titulo, '.', -2), '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(titulo, '.', -1) AS UNSIGNED) ASC");
while($r = mysql_fetch_array($q)){
extract($r);
?>
<option value="<?= $idProducto; ?>"
<?php
if($id_producto == $idProducto){
echo"selected='selected'";
} ?>
><?= $tituloProducto ?>
</option>
<?php
}
?>
</select>
<label>Criterio de Cobro</label>
<select name="tipo_cobro" class="input_form" required="required">
<option value="0" <?php if($tipo_cobro == "0"){echo"selected='selected'";} ?>>Seleccione...</option>
<option value="1" <?php if($tipo_cobro == "1"){echo"selected='selected'";} ?>>Fijo</option>
<option value="2" <?php if($tipo_cobro == "2"){echo"selected='selected'";} ?>>Por Hora</option>
<option value="3" <?php if($tipo_cobro == "3"){echo"selected='selected'";} ?>>Otro</option>
</select>
<div class="clear10"></div>
<label>Monto</label>
<input type="text" name="monto" class="input_form" value="<?= $monto; ?>" >
<div class="clear10"></div><label>Producto</label>
<select name="id_producto" class="input_form" id="idCategoriaProducto">
<option value="" selected="selected">Seleccione...</option>
<?php
$q = mysql_query("SELECT id AS idProducto, titulo AS tituloProducto
FROM productos WHERE operando = 1
ORDER BY CAST(SUBSTRING_INDEX(titulo, '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(SUBSTRING_INDEX(titulo, '.', -2), '.', 1) AS UNSIGNED) ASC,
CAST(SUBSTRING_INDEX(titulo, '.', -1) AS UNSIGNED) ASC");
while($r = mysql_fetch_array($q)){
extract($r);
?>
<option value="<?= $idProducto; ?>"
<?php
if($id_producto == $idProducto){
echo"selected='selected'";
} ?>
><?= $tituloProducto ?>
</option>
<?php
}
?>
</select>
<label>Criterio de Cobro</label>
<select name="tipo_cobro" class="input_form" required="required">
<option value="0" <?php if($tipo_cobro == "0"){echo"selected='selected'";} ?>>Seleccione...</option>
<option value="1" <?php if($tipo_cobro == "1"){echo"selected='selected'";} ?>>Fijo</option>
<option value="2" <?php if($tipo_cobro == "2"){echo"selected='selected'";} ?>>Por Hora</option>
<option value="3" <?php if($tipo_cobro == "3"){echo"selected='selected'";} ?>>Otro</option>
</select>
<div class="clear10"></div>
<label>Monto</label>
<input type="text" name="monto" class="input_form" value="<?= $monto; ?>" >
<div class="clear10"></div>php mysql
php mysql
edited Nov 14 '18 at 2:14
Jeff
6,31911025
6,31911025
asked Nov 14 '18 at 2:06
Luis DorizLuis Doriz
1
1
php is a server code, you can't expect to make a single change and expect it to update the results. all the inline php will occur before the page loads
– comphonia
Nov 14 '18 at 2:58
but if i load the price and just filter it after the selection of both fields i believe it could happen
– Luis Doriz
Nov 14 '18 at 3:18
yes. if you plan on setting or passing the variable to the page before it loads. Is your price supposed to go in the query? I don't see it anywhere.
– comphonia
Nov 14 '18 at 3:25
add a comment |
php is a server code, you can't expect to make a single change and expect it to update the results. all the inline php will occur before the page loads
– comphonia
Nov 14 '18 at 2:58
but if i load the price and just filter it after the selection of both fields i believe it could happen
– Luis Doriz
Nov 14 '18 at 3:18
yes. if you plan on setting or passing the variable to the page before it loads. Is your price supposed to go in the query? I don't see it anywhere.
– comphonia
Nov 14 '18 at 3:25
php is a server code, you can't expect to make a single change and expect it to update the results. all the inline php will occur before the page loads
– comphonia
Nov 14 '18 at 2:58
php is a server code, you can't expect to make a single change and expect it to update the results. all the inline php will occur before the page loads
– comphonia
Nov 14 '18 at 2:58
but if i load the price and just filter it after the selection of both fields i believe it could happen
– Luis Doriz
Nov 14 '18 at 3:18
but if i load the price and just filter it after the selection of both fields i believe it could happen
– Luis Doriz
Nov 14 '18 at 3:18
yes. if you plan on setting or passing the variable to the page before it loads. Is your price supposed to go in the query? I don't see it anywhere.
– comphonia
Nov 14 '18 at 3:25
yes. if you plan on setting or passing the variable to the page before it loads. Is your price supposed to go in the query? I don't see it anywhere.
– comphonia
Nov 14 '18 at 3:25
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292183%2fphp-form-handling-dataload%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53292183%2fphp-form-handling-dataload%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
php is a server code, you can't expect to make a single change and expect it to update the results. all the inline php will occur before the page loads
– comphonia
Nov 14 '18 at 2:58
but if i load the price and just filter it after the selection of both fields i believe it could happen
– Luis Doriz
Nov 14 '18 at 3:18
yes. if you plan on setting or passing the variable to the page before it loads. Is your price supposed to go in the query? I don't see it anywhere.
– comphonia
Nov 14 '18 at 3:25