Jump to content

.php help for a noob


Harm Millaard
 Share

Recommended Posts

Being a complete noob with php and MySQL, I'm doing this step by step, but I really appreciate your support in this.I got a page http://ppbm5.com/DB-PPBM5-2.php where I have a form to query the database.I can echo the results of the query to the screen like this:Query.pngusing code in a file called file.lib.php.What I need is to get that string into my regular .php page and of course drop the last comma, and get them into variables that allow me to create query strings for WHERE statements to do the query.My regular .php page includes this code:<iframe frameborder="None" src="the form.php" style="width:940px;height:152px;border:none;"></iframe> which in turn activates form.lib.php to generate the string.It may be relevant. Any suggestions?

Edited by Harm Millaard
Link to comment
Share on other sites

If your PHP script can echo your post data, you should already HAVE "variables that allow me to create query strings for WHERE statements to do the query." There should be no reason at all to (1) create that string and then (2) bust it apart to make new variables.At least, that's what it sounds like you want to do.Maybe I don't understand what this means: "get that string into my regular .php page"

Link to comment
Share on other sites

If your PHP script can echo your post data, you should already HAVE "variables that allow me to create query strings for WHERE statements to do the query." There should be no reason at all to (1) create that string and then (2) bust it apart to make new variables.At least, that's what it sounds like you want to do.Maybe I don't understand what this means: "get that string into my regular .php page"
To show you how much of a noob I am, I use echo $value; from the form.lib.php file to echo it on screen.How do I get that '$value' variable into my regular .php page and then disect it into distinct variables? There are 14 of them.
Link to comment
Share on other sites

Where does the value of $value come from? How is that string created?
Hope this covers it all:function sendFormMail( $form_mail, $sFileName = "" ) { $to = filterEmail(PHPFMG_TO) ; $cc = filterEmail(PHPFMG_CC) ; $bcc = filterEmail(PHPFMG_BCC) ; // simply chop email address to avoid my website being abused if( false !== strpos( strtolower($_SERVER['HTTP_HOST']),'formmail-maker.com') ){ $cc = substr($cc, 0, 50); $bcc = substr($bcc,0, 50); }; $subject = PHPFMG_SUBJECT ; $from = $to ; $fromName = ""; $titleOfSender = ''; $firstName = ""; $lastName = ""; $strip = get_magic_quotes_gpc() ; $content = '' ; $style = 'font-family:Verdana, Arial, Helvetica, sans-serif; font-size : 13px; color:#474747;padding:6px;border-bottom:1px solid #cccccc;' ; $tr = array() ; // html table $csvValues = array(); $cols = array(); $replace = array(); $RecordID = phpfmg_getRecordID(); $isWritable = is_writable( dirname(PHPFMG_SAVE_ATTACHMENTS_DIR) ); foreach( $form_mail as $field ){ $field_type = strtolower($field[ "type" ]); if( 'sectionbreak' == $field_type ){ continue; }; //$value = trim( $_POST[ $field[ "name" ] ] ); $value = '"' . phpfmg_field_value( $field[ "name" ] ) . '",'; $value = $strip ? stripslashes($value) : $value ; echo $value; if( 'attachment' == $field_type ){ $value = $isWritable ? phpfmg_file2value( $RecordID, $_FILES[ $field[ "name" ] ] ) : $_FILES[ $field[ "name" ] ]['name']; //$value = $_FILES[ $field[ "name" ] ]['name']; }; $content .= $field[ "text" ] . " \t : " . $value .PHPFMG_LNCR; $tr[] = "<tr> <td valign=top style='{$style};width:33%;border-right:1px solid #cccccc;'>" . $field[ "text" ] . " </td> <td valign=top style='{$style};'>" . nl2br($value) . " </td></tr>" ;
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...