NYCPHP Meetup

NYPHP.org

[nycphp-talk] Help Request

Oktay Altunergil nyphp at altunergil.com
Mon May 20 11:47:54 EDT 2002


Jerry,

Try this on the page you submit to:

print "<PRE>";
print_r($HTTP_POST_VARS);
print "</PRE>";

It will let you see the whole thing easily. By the way, I didn't have time to look at the code you sent me. Please make sure you're indeed using the POST method on the forms and not using GET.

Oktay Altunergil

On Mon, 20 May 2002 11:15:30 -0400
Jerry Wing <jwing at www.erols.com> wrote:

> Hans, thank you for your help... the problem is in the UPDATE statement 
> and the fact that the variables $keyword1, $keyword2, etc, in the
> statement have no values.  IOW the values that are in the text boxes in
> script 2 where the current data is are not carried to script 3 where the
> UPDATE statement is located when the modify table button is pressed. 
> You know Hans, I have successfully updated records with this form of the
> UPDATE statement just yesterday with a small test table i wrote, and
> when i go back and try it with the table I am using and it does not
> work, i.e. the values of the variables are not passing from the second
> to the third script, i wonder if my browser is screwing me up... I have
> netscape 4.5 that i am running....I will try $HTTP_POST_VARS[xxx] and
> see if i can pick up the values in the array when the second script is
> submitted.  Thanks Hans for your help on all this and on getting me onto
> the forum where i can get assistance.  Jerry
> 
> Hans Zaunere wrote:
> > 
> > <paralist>This message contained 1 file(s) and is available at http://nyphp.org/list/paralist_archive.html?L_mid=128</paralist>
> > 
> > There could be any number of problems, however I would start by looking
> > at the SQL that actually gets generated and try to clean things up a
> > bit.  Although this maybe not be helpful at all, I've attached a file
> > with some formatting/etc you may want to consider.
> > 
> > I personally dispise the "or die()" scheme (too Perly) so I've used
> > if() statements.  The real important things to consider is 1) I always
> > like to supply what connection handle I want to deal with - otherwise
> > things can get confusing if you have multiple database handles.  2) the
> > key for large SQL statements is to print it out and examine it if you
> > have problems.
> > 
> > Of course you may not need so many mysql_escape_string() calls,
> > depending on the data source, and you'll have to check that your column
> > types are all agreeable, DB perms, etc.
> > 
> > Hope this helps,
> > 
> > Hans Z.
> > 
> > <?php
> > 
> > if( $var2 == 'Return To Admin Home Page') {
> >    header('Location: index.htm');
> >    exit;
> > 
> > > <?php
> > > If ($var2=="Return To Admin Home Page"){
> > >         header("Location:index.htm");
> > >         exit;
> > > }elseif ($var1=="Modify Database"){
> > >
> > >                 $connection = mysql_connect("localhost", "jwing",
> > > "xxxxxxxx")
> > >                         or die ("Couldn't connect to server.");
> > >
> > >
> > >                 $db = mysql_select_db("jwing", $connection)
> > >                         or die ("Couldn't select database.");
> > >
> > > $sql = "update jobs
> > > set
> > > KEYWORD1 = \\"$keyword1\\",
> > > KEYWORD2 = \\"$keyword2\\",
> > > KEYWORD3 = \\"$keyword3\\",
> > > KEYWORD4 = \\"$keyword4\\",
> > > KEYWORD5 = \\"$keyword5\\",
> > > COMP_ID = \\"$comp_id\\",
> > > SHOW_DATE = \\"$show_date\\",
> > > JOB_CAT = \\"$job_cat\\",
> > > JOB_LOC = \\"$job_loc\\",
> > > JOB_TITLE = \\"$job_title\\",
> > > JOB_DESC = \\"$job_desc\\",
> > > JOB_SALARY = \\"$job_salary\\",
> > > FIRST_NAME = \\"$first_name\\",
> > > LAST_NAME = \\"$last_name\\",
> > > AD_EMAIL = \\"$ad_email\\",
> > > CNTCT_EMAIL = \\"$cntct_email\\",
> > > USR_NAME = \\"$usr_name\\",
> > > P_WORD = \\"$p_word\\",
> > > AD_PHONE = \\"$ad_phone\\",
> > > CNTCT_PHONE = \\"$cntct_phone\\",
> > > AD_FAXPHONE = \\"$ad_faxphone\\",
> > > WEB_SITE = \\"$web_site\\",
> > > CCNAME = \\"$ccname\\",
> > > CCNUMBER = \\"$ccnumber\\",
> > > MONTHEXP = \\"$monthexp\\",
> > > YEAREXP = \\"$yearexp\\",
> > > CCTYPE = \\"$cctype\\",
> > > STREET1A = \\"$street1A\\",
> > > STREET2A = \\"$street2A\\",
> > > STREET3A = \\"$street3A\\",
> > > CC_CITY = \\"$cc_city\\",
> > > CC_STATE = \\"$cc_state\\",
> > > CC_ZIP = \\"$cc_zip\\",
> > > TRBLFONE = \\"$trblfone\\"
> > > where job_id = \\"$job_id\\"";
> > >
> > > $sql_result = mysql_query($sql) or die (mysql_error());
> > > echo "
> > > <HTML>
> > > <HEAD>
> > > <TITLE></TITLE>
> > > </HEAD>
> > > <BODY background=\\"rimmabg.jpg\\">
> > > <FORM METHOD=\\"POST\\" ACTION=\\"jl2s1s.php\\">
> > >
> > > <input name=\\"var1\\" value=\\"Return To Admin Home Page\\"
> > > Type=\\"submit\\">
> > >
> > > </form>
> > > </BODY>
> > > </HTML>
> > > ";
> > > };
> > > ?>
> > >
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > LAUNCH - Your Yahoo! Music Experience
> > http://launch.yahoo.com
> 



More information about the talk mailing list