Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

274
Views
La URL de acción del formulario no funciona en codeigniter

Estoy tratando de usar la URL en la acción del formulario sin usar el asistente de formulario en Codeigniter, pero no funciona.

 <form method="post" action="<?php echo base_url().'test'; ?>"> <form method="post" action="/main_controller/test">

función del controlador

 public function test(){ echo "test function"; }

el error que estoy recibiendo

http://prntscr.com/eyzhdd

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Debería ser

 <form method="post" action="<?php echo base_url()?>index.php/main_controller/test">

también base_url() debe definirse como ( application/config/config.php )

 https://stackoverflow.com/ ^ on the end $config['base_url'] = 'https://stackoverflow.com/'; # Line 26 if version 3.0+

 <?php echo base_url()?>index.php/main_controller/test ^ ^ ^ ^ base URL index Controller Name Method name

Consulte la documentación de Codeigniter .

about 4 years ago · Santiago Trujillo Report

0

<form method="post" action="<?php echo base_url().'/main_controller/test/'; ?>">

Use Like this y defina la URL base en el archivo http://www.example.com/ config.php

about 4 years ago · Santiago Trujillo Report

0

Para usar base_url() , primero debe tener cargado el URL Helper. Esto se puede hacer en application/config/autoload.php (alrededor de la línea 67):

 $autoload['helper'] = array('url');

O, manualmente en el controlador:

 $this->load->helper('url');

Entonces cambia

 <form method="post" action="<?php echo base_url().'test'; ?>">

a

 <form method="post" action="<?php echo base_url()?>index.php/main_controller/test">

Finalmente, agregue la URL base en application/config/config.php. Por ejemplo,

 $config['base_url'] = 'http://example.com/';

De manera predeterminada, el archivo index.php se incluirá en sus URL: puede eliminar index.php de la URL de acción con .htaccess file . Por favor lea la documentación

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!