Ver Mensaje Individual
  #1 (permalink)  
Antiguo 06/02/2016, 10:03
jagryalm
 
Fecha de Ingreso: diciembre-2015
Mensajes: 9
Antigüedad: 8 años, 4 meses
Puntos: 0
como modificar una funcion php

Buenas tardes tengo una pregunta llevo ya varios dias tratando de modificar un archivo php el codigo es el siguiente:

Código PHP:
function register($key$value) {
 
$image = array();
 global 
$image;
 
$image[$key] = $value;
}

function 
input($name$value$attributes = array()) {
$defaultAttributes = array(
 
'id' => $name,
 
'name' => $name
 
);

    
$finalAttributes array_merge($defaultAttributes$attributes);
    if (
$value !== null) {
        
$finalAttributes['value'] = $value;
    }

    return 
Tags('input'$finalAttributesfalse);
}

function 
Tags($tag$attributes$content false) {
 
$code '<' $tag;
 foreach (
$attributes as $attribute => $value) {
 
$code .= ' ' $attribute '="' htmlentities(stripslashes($value), ENT_COMPAT) . '"';
}

if (
$content === false || $content === null) {
 
$code .= ' />';
} else {
 
$code .= '>' $content '</' $tag '>';
}
 return 
$code;

y en el formulario se tiene el siguiente código para manipular:

Código PHP:
$numbers intval(isset($_POST['numbers']) ? $_POST['numbers'] : 30);
register('numbers'$numbers);
echo 
input('numbers'$numbers, array('type' => 'number''min' => 30'max' => 50'step' => 5'required' => 'required')); 
y e pasado los mismo datos a un html directamente de la siguiente manera:
Código:
<input name="numbers" id="numbers" value="<?php $numbers = intval(isset($_POST['numbers']) ? $_POST['numbers'] : 30); echo $numbers ?>" type="number" min="30" max="50" step="5" required>

al hacer esto directamente con el formulario me deja de funcionar el código php alguna sugerencia, se los agradecería bastante ya que dicha función es para realizar un barcode con inserción a una base de datos.

agradezco cualquier ayuda.