This topic is locked
[SOLVED]

 getting value from form on events page

10/31/2011 4:26:28 PM
PHPRunner General questions
S
stiven author

Hello,
On the edit page on the visual editor i added some new fields html input.. so i can save the info on just one field on the database but im wondering how do i get the value of the new fields i added on the edit page?? here is what i've got so far the name of the input field in the edit page is "plb2"



$pbl1 = $values['pallbearer'];// this is the field in the database

$pbl2 = $_POST['pbl2']; // so i tried this but not luck, i also tried postvalue('plb2') but didn't work either
$pbl = $pbl1.",".$pbl2;
global $conn;
$strSQLUpdate = "UPDATE service_box SET pallbearer = '$pbl' WHERE case_no = '".$values['case_no']."' ";

db_exec($strSQLUpdate,$conn);


does anyone know how to get the value from the new input i made on the edit page? thanks..

S
stiven author 11/1/2011

hello,
this didn't work for me, nothing happens... no errors or anything.. i need it on the after record added events.. on the link it says it works on the before add event page is this the reason why it didn't work?

C
cgphp 11/1/2011

Post the code of:

  • the html input fields
  • the javascript on load event

Sergey Kornilov admin 11/1/2011

If you need more help with this post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.
This sort of coding issue is hard to resolve without having access to your application.

S
stiven author 11/1/2011

ok this is what i have on the htm page..


<DIV

{$pageattrs}>

{BEGIN container_1}

<TABLE class=runner-c border=2 rules=all cellSpacing=2 cellPadding=0>

<TBODY>

{BEGIN pallbearer_tabfieldblock}<TR class="runner-row style1">

<TD style="WIDTH: 178px" class="runner-cc runner-cc1">{BEGIN pallbearer_label}

Pallbearer One{END pallbearer_label}</TD>

<TD style="WIDTH: 266px" class="runner-cc alt">

{$pallbearer_editcontrol}</TD></TR>

{END pallbearer_tabfieldblock}<TR class="runner-row style1">

<TD class="runner-cc runner-cc1">



<DIV contentEditable=true>Pallbearer&nbsp; Two</DIV></TD>

<TD class="runner-cc alt">

<INPUT

style="WIDTH: 260px; HEIGHT: 19px" name=plb2 size=39></TD></TR>

<TR class="runner-row style1">

<TD style="WIDTH: 178px" class="runner-cc runner-cc1">



<DIV contentEditable=true>Pallbearer Three</DIV></TD>

<TD style="WIDTH: 266px" class="runner-cc alt">

<INPUT

style="WIDTH: 260px; HEIGHT: 19px" name=plb3 size=39></TD></TR>

<TR class="runner-row style1">

<TD style="WIDTH: 178px" class="runner-cc runner-cc1">



<DIV contentEditable=true>Pallbearer Four</DIV></TD>

<TD style="WIDTH: 266px" class="runner-cc alt">

<INPUT

style="WIDTH: 260px; HEIGHT: 19px" name=plb4 size=39></TD></TR>

<TR class="runner-row style1">

<TD style="WIDTH: 178px" class="runner-cc runner-cc1">



<DIV contentEditable=true>Pallbearer Five</DIV></TD>

<TD style="WIDTH: 266px" class="runner-cc alt">

<INPUT

style="WIDTH: 260px; HEIGHT: 19px" name=plb5 size=39></TD></TR>

<TR class="runner-row style1">

<TD style="WIDTH: 178px" class="runner-cc runner-cc1">



<DIV contentEditable=true>Pallbearer Six</DIV></TD>

<TD style="WIDTH: 266px" class="runner-cc alt">

<INPUT

style="WIDTH: 260px; HEIGHT: 19px" name=plb6

size=39></TD></TR></TBODY></TABLE>{END container_1}</DIV>


this is on the javascript onload event



this.on('beforeSave', function(formObj, fieldControlsArr, pageObj){

var val = $("#plb2").val();

formObj.baseParams['plb2'] = val;

});


and this is on the after record updated event page


$pbl1 = $values['pallbearer'];

$pbl2 = $_REQUEST['pbl2'];
$pbl = $pbl1.",".$pbl2;
global $conn;
$strSQLUpdate = "UPDATE service_box SET pallbearer = '$pbl' WHERE case_no = '".$values['case_no']."' ";

db_exec($strSQLUpdate,$conn);
C
cgphp 11/1/2011

The error is in the HTML code. The right code for the INPUT field is:

<INPUT style="WIDTH: 260px; HEIGHT: 19px" id=plb2 size=39>
S
stiven author 11/1/2011

that didn't work either :/.. i have a table for passengers.. i want to have fields for 5 passengers the data i need to get from them is the name, departure date, returning date, age, and route.. the thing is that i need for up to five and most of the time it is only one or none at all so the values would be null and it is just a waist having passenger_name1, passenger_name2 and so on... so what i wanted to do is have just passenger_name and separate them by commas and the other 4 fields add them manually on the edit page.. but this is not working so my question is do you have any suggestions on how would be the best way to achieve this? i would really appreciate it.. thanks.

C
cgphp 11/1/2011

The query is buggy. Try this:

$strSQLUpdate = "UPDATE service_box SET pallbearer = '".$pbl."' WHERE case_no = '".$values['case_no']."'";
S
stiven author 11/1/2011



The query is buggy. Try this:

$strSQLUpdate = "UPDATE service_box SET pallbearer = '".$pbl."' WHERE case_no = '".$values['case_no']."'";



still nothing.. im trying to echo $_REQUEST['plb2'] but i get nothing is the value supposed to pass through the url? cause its not passing this is the url http://latino-americana.com/mortuary/service_box_edit.php?ferror=1&editid1=6&; i don't know what ferror means.. and why is that happening..

C
cgphp 11/1/2011

The id value of the input field is plb2 but in the query you access the $_REQUEST array with the key pbl2

S
stiven author 11/1/2011

OMG spelling error didn't even notice it..! thank you so much!!! it's working now...