-1

i cannot print my desire path in the form action i set a condition that id the $edit array is set then page goes to add_new_proposal function which i define in my controller and if the $edit variable is not set then it goes to edit_new_proposal function

here is the code of action of form

 <form role="form" method="post" action="<?php if(isset($edit)){echo 'base_url();proposal/add_new_proposal';}else{echo 'base_url();proposal/edit_new_proposal';}?> " enctype="multipart/form-data">
tereško
  • 58,060
  • 25
  • 98
  • 150
shani
  • 11
  • 4
  • 3
    `echo base_url() . 'proposal/add_new_proposal';` read more about [concatenation in php](http://php.net/manual/en/language.operators.string.php) – hassan Mar 18 '18 at 09:17
  • can you give ma a feed back on my this Question i will be very thankful to you Here is the [Question](https://stackoverflow.com/questions/49337923/how-to-write-url-in-ajax-request-in-codeigniter-php?noredirect=1#comment85677023_49337923) – shani Mar 18 '18 at 09:30

2 Answers2

1

Change:

echo 'base_url();proposal/add_new_proposal';

to:

echo base_url().'proposal/add_new_proposal';

And

echo 'base_url();proposal/edit_new_proposal';

to:

echo base_url().'proposal/edit_new_proposal';
Karlo Kokkak
  • 3,674
  • 4
  • 18
  • 33
  • Combining strings together: https://stackoverflow.com/questions/8336858/how-to-combine-two-strings-together-in-php – Karlo Kokkak Mar 18 '18 at 09:20
  • thanks so much for your feed back – shani Mar 18 '18 at 09:26
  • can you give ma a feed back on my this Question i will be very thankful to you Here is the [Question](https://stackoverflow.com/questions/49337923/how-to-write-url-in-ajax-request-in-codeigniter-php?noredirect=1#comment85677023_49337923) – shani Mar 18 '18 at 09:30
-1

According to your code base_url() is a function and you are adding it as a string in the echo statement. Change it as shown below:

 <form role="form" method="post" action="<?php if(isset($edit)){echo base_url() . ‘proposal/add_new_proposal';}else{echo base_url() . ‘proposal/edit_new_proposal';}?> " enctype="multipart/form-data">
hungersoft
  • 531
  • 4
  • 8
  • thanku very much :) – shani Mar 18 '18 at 09:26
  • hungersoft can you give ma a feed back on my this Question i will be very thankful to you Here is the [Question](https://stackoverflow.com/questions/49337923/how-to-write-url-in-ajax-request-in-codeigniter-php?noredirect=1#comment85677023_49337923) – shani Mar 18 '18 at 09:28