Jump to content

Travist6983

Members
  • Posts

    39
  • Joined

  • Last visited

Everything posted by Travist6983

  1. Thanks for the reply yeah i have a working weather one as well that is where my starting code came from <?php $soapclient = new SoapClient('http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL'); $params = array('ZIP' => '48067'); $response = $soapclient->GetCityForecastByZIP($params); echo '<pre>'; var_dump($response); echo '</pre>'; ?> I think there were some issues in my array as well so i have now updated to be this. <?php // Create the client object $soapclient = new SoapClient('Link-To-WSDL-End-Point'); $Header = array( 'UsernameToken' => array( 'Username' => 'Username', 'Password' => 'Password' ) ); $Body = array( 'getItemDetailInfoRequest' => array( 'requestHeader' => array( 'clientRequestId' => 1, 'projectNumber' => 64111, 'requestDateTime' => '2014-03-20T14:05:24.572Z' ), 'getItemDetailInfoList' => array( 'itemDetailSearchCriteria' => array( 'itemNumber' => 'F00573019120B', 'projectNumber' => 64111 ) ) ) ); $response = $client->__soapCall("UsernameToken",array($Header), "getItemDetailInfoRequest",array($Body)); // $response = $soapclient->UsernameToken($Header)->getItemDetailInfoRequest($Body); echo '<pre>'; var_dump($response); echo '</pre>'; ?>
  2. I will warn you that i have never used PHP to call a web service but have spent the last 2 days googling with trial and error and think that i have come to a point where i have no idea what to do as nothing is working. Here is my PHP code... <?php $soapclient = new SoapClient('Link-To-EndPoint'); $params = array('Username' => 'Username', 'Password' => 'Password', 'clientRequestId' => 1, 'projectNumber' => 64111, 'requestDateTime' => '2014-03-16T11:05:24.572Z', 'itemNumber' => 'F00573019120B', 'projectNumber' => 64111 ); $response = $soapclient->GetItemDetailInfo($params); echo '<pre>'; var_dump($response); echo '</pre>'; ?> And here is the request, probably worth noting that this gives the full response and works when i use SOAP UI to make the request. <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <env:Header> <Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> <UsernameToken> <Username>Username</Username> <Password>Password</Password> </UsernameToken> </Security> </env:Header> <env:Body> <getItemDetailInfoRequest> <requestHeader> <clientRequestId>1</clientRequestId> <projectNumber>64111</projectNumber> <requestDateTime>2014-03-20T14:05:24.572Z</requestDateTime> </requestHeader> <getItemDetailInfoList> <itemDetailSearchCriteria> <itemNumber>F00573019120B</itemNumber> <projectNumber>64111</projectNumber> </itemDetailSearchCriteria> </getItemDetailInfoList> </getItemDetailInfoRequest> </env:Body> </env:Envelope> When i load the page i get a blank screen nothing comes out from $response, I have no idea if i am close to making this work or if i am super far off with this. Using the above code i am able to make a public weather SOAP Web Service work which makes me think i am close. Any help would be appreciated!
  3. I tried everything except joining the [0] to ['components']['primary_number']; Thank you very much!
  4. OK i am very new to PHP so please be gentle LOL. I am posting a form to Liveaddress API and then i get the response back in an array it looks like this Array ( [0] => Array ( [input_index] => 0 [candidate_index] => 0 [delivery_line_1] => 13700 Oakland St [last_line] => Highland Park MI 48203-3173 [delivery_point_barcode] => 482033173009 [components] => Array ( [primary_number] => 13700 [street_name] => Oakland [street_suffix] => St [city_name] => Highland Park [state_abbreviation] => MI [zipcode] => 48203 [plus4_code] => 3173 [delivery_point] => 00 [delivery_point_check_digit] => 9 ) [metadata] => Array ( [record_type] => S [zip_type] => Standard [county_fips] => 26163 [county_name] => Wayne [carrier_route] => C021 [congressional_district] => 14 [rdi] => Commercial [elot_sequence] => 0024 [elot_sort] => A [latitude] => 42.40858 [longitude] => -83.08783 [precision] => Zip9 ) [analysis] => Array ( [dpv_match_code] => Y [dpv_footnotes] => AABB [dpv_cmra] => N [dpv_vacant] => N [active] => Y [footnotes] => L# ) ) ) How would i take primary_number and turn that into a variable to then insert into a database? Thanks, T
  5. I gotcha that does make more logical sense to me as well. That was actually code that was suggested to me from another forum. But really all they were doing were telling me i am crappy coder which in this case i know i am not great. But they weren't offer to help just kinda bashing me. I appreciate you taking the time to go though it and explain it. Cheers have a great weekend @Barand
  6. Thanks You! @Barand that is now making it work as i expected it too... Your probably right about the alias. Like i mentioned i am VERY new this PHP stuff. Can you kind of explain the difference between what i wrote and how you fixed it?
  7. Thanks for the reply @davidannis It is now throwing my error message that the promocode has already been used but it hasnt been. I am using a blank record from the database. Any other suggestions?
  8. Hello All I have the code below that i cant seem to get to work. At the bottom here you will find my code with a If Else statement. That i just cant get to do what i want. so i am hoping someone can help guide me in the right direction. I am gonna be honest i am VERY new to PHP so please bare with me. On the first If it checks to make sure that the promocode that was entered is in the database and that part works. On the second if i want it to look through the database and find the promocode and confirm that there is not an email address associated with that promocode record. Currently it is not doing that i can enter a promo code that has an email or not and it inserts into the DB. This is where my problem lies am i doing this completely wrong is there a better way to accomplish what i am trying to do here? Or have i just overlooked something small? $promosql = "SELECT email IS NULL or email = '' has_email FROM formdata WHERE promoCode = '$varPromo'"; $promoraw = $mysqli->query($promosql); if($promoraw->num_rows != 1) { $promo .= "$varPromo is not a valid promocode \n"; } else { $row = $promoraw->fetch_assoc(); if ($row['has_email']) { // Promo code has been used $dupe .= "$varPromo has already been used on $varDate \n"; } else { // Insert into table $sql = "INSERT INTO formdata (promoCode, name, email, address, city, state, zip, submitDate) VALUES (". PrepSQL($varPromo) . ", " . PrepSQL($varName) . ", " . PrepSQL($varEmail) . ", " . PrepSQL($varAddress) . ", " . PrepSQL($varCity) . ", " . PrepSQL($varState) . ", " . PrepSQL($varZip) . ", " . PrepSQL($varDate) . ")"; $mysqli->query($sql); header("location: index.php?success=1"); exit(); } }
  9. Thanks for the reply parkerj and thanks for the prevention against SQL injections JD. But it still isnt posting to the database. I am thinking maybe it is the way that i configured the database. I have uploaded a screenshot of PHPMyAdmin below does anything look off to you?
  10. Hello - I am trying to learn PHP here and i have created a simple form that should be posting to the database but i cant for the life of me figure out why? If anyone could point me at what i am missing that would be great PHP Code at the top of my page... <?php if($_POST['formSubmit'] == "Submit") { $mysqli = new mysqli("localhost", "root", "060983tt", "test"); if ($mysqli->connect_error) {die('Connect Error: ' . $mysqli->connect_error);} $varAssign = $_POST['formAssign']; $varDue = $_POST['formDue']; $varLink = $_POST['formLink']; $sql = "INSERT INTO table (assign, due, link) VALUES (". $varAssign . ", " . $varDue . ", " . $varLink . ")"; $mysqli->query($sql); header("location: index.php?success=1"); exit(); } ?> HTML Form <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post"> <fieldset> <h2>Assignment 1</h2> <div class="form-group"> <label for="exampleInputEmail">Assignment Title</label> <input type="text" class="form-control" name="formAssign1" placeholder="John Smith"> </div> <div class="form-group"> <label for="exampleInputEmail">Due Date</label> <input type="text" class="form-control" name="formDue1" placeholder="john@sample.com"> </div> <div class="form-group"> <label for="exampleInputEmail">File Name </label> <input type="text" class="form-control" name="formLink1" placeholder="123 Main"> </div> <input type="submit" name="formSubmit" value="Submit" class="btn btn-default" /> <?php $success = $_GET["success"]; if(isset($success)) { echo("<div class=\"success\">"); echo "Message was sent successfully!"; echo("</div>\n"); } ?> </fieldset> </form> Thanks
  11. I am pulling my hair out here i want to send the page that the contact form was sent from. I have looked at a 1000 articles about how to do this (Not very good in PHP) But it isnt working for me. Here is the code for my form page <header> <img src="images/header.png"/> </header> <div id="page-wrap"> <div id="contact-area"> <form method="post" action="contactengine.php"> <label for="Name">Name:</label> <input type="text" name="Name" id="Name" /> <label for="City">Market:</label> <input type="text" name="Market" id="Market" /> <label for="Email">Email:</label> <input type="text" name="Email" id="Email" /> <input type="hidden" value="<?php echo $_SERVER['HTTP_REFERER'] ?>" name="Page" /> <input type="submit" name="submit" value="Submit" class="submit-button" /> </form> <div style="clear: both;"></div> </div> </div> And here is the file that i am posting too... <?php $EmailFrom = "sample@gmail.com"; $EmailTo = "sample@gmail.com"; $Subject = "Contact Form"; $Name = Trim(stripslashes($_POST['Name'])); $Market = Trim(stripslashes($_POST['Market'])); $Email = Trim(stripslashes($_POST['Email'])); $Page = $_POST['Page']; // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Market: "; $Body .= $Market; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Page: "; $Body .= $Page; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to landing page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=success.htm\">"; //Edit here for Landing Page } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> Everything is being populated on the email that is being sent except $Page which is the hidden field on the form. Am i missing a ";" somewhere that is breaking it? I am lost any help would be appreciated! Thanks in advance!
  12. BAHAHA Thanks Christian For pushing me to find the answer my self! I got it to work! Have a great holiday! Travis
  13. Thanks for replying Christian - is this the line you are talking about? [color=#000000][size=2]echo [/size][/color][color=#008800][size=2]"<td>"[/size][/color][size=2][color="#666600"].[/color][/size]html_entity_decode($row[6])).[color=#008800][size=2]"</td>"[/size][/color][color=#666600][size=2];[/size][/color][color=#000000][size=2] [/size][/color] Thanks! I tried it with out the utf8 stuff $html_decoded = html_entity_decode($row[6]); But that didnt work either... I am not a PHP guy i know just enough to be dangerous... Do i even need to decode it and save it in a variable? or can i do something like this.... html_entity_decode($row[6])
  14. Hello - I am trying to view a table in database that were entered as from a wysiwyg editor. When i export the data it isnt really readable. So i found this little script and was trying to output the data so i could copy it to excel. i am able to get the data out but then it looks like this... <p class="body"> <span style="font-size: 14px;"><span style="color: rgb(0, 0, 255);">Features:</span></span></p> <p> <span style="font-weight: bold;">• Over-sized 0.58" ID for high flow<br /> • Heavy duty 0.25" wall thickness for durability<br /> • Self-weighted for easy installation<br /> So i am trying to output that data without all of the HTML tags using the html_entity_decode, can anyone see where i am going wrong with the below code? <?php // set database server access variables: $host = "localhost"; $user = "*****"; $pass = "********"; $db = "************"; // open connection $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); // create query $query = "SELECT * FROM product_description"; // execute query $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error()); $html_decoded = utf8_encode(html_entity_decode($row[6])); // see if any rows were returned if (mysql_num_rows($result) > 0) { // yes // print them one after another echo "<table cellpadding=10 border=1>"; while($row = mysql_fetch_row($result)) { echo "<tr>"; echo "<td>".$row[2]."</td>"; echo "<td>".$html_decoded."</td>"; echo "<td>".$row[6]."</td>"; // This outputs the row to look something like this [color=#000000][font=Times][size=1]<p class="body"> <span style="font-size: 14px;"><span style="color: rgb(0, 0, 255);">Features:[/size][/font][/color] echo "</tr>"; } echo "</table>"; } else { // no // print status message echo "No rows found!"; } // free result set memory mysql_free_result($result); // close connection mysql_close($connection); ?>
  15. My HERO! Andy thanks so much... when i look at the code you wrote i see where i messing up.... I didnt understand how to store the values from the loop in a new variable... Why is the necessary? $selected_values = ''; everything works just trying to learn something here... Thanks again, Travis
  16. Here is the complete code... I am not a PHP guy i am just trying to help out a friend with there site... My focus is all front end... any help with this would be great! Thanks, Travis Yeah not a problem, Here is contactengine.php <?php $EmailFrom = "travisjterry@gmail.com"; $EmailTo = "travisjterry@gmail.com"; $Subject = "ShutterBooth Collage Page Form"; $Name = Trim(stripslashes($_POST['Name'])); $Last = Trim(stripslashes($_POST['last'])); $Email = Trim(stripslashes($_POST['Email'])); $Order = Trim(stripslashes($_POST['order'])); if( isset( $_POST['interest'] ) && is_array($_POST['interest']) ) { foreach( $_POST['interest'] as $value ) { //each $value is a selected value from the form } } // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "First Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Last Name: "; $Body .= $Last; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "ShutterYou Order Date: "; $Body .= $Order; $Body .= "\n"; $Body .= "Pictures Selected: "; $Body .= $value; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> and here is the php file that is creating the images and form... <form method="post" action="contactengine.php"> <p> <?php /** settings **/ $images_dir = 'images/'; $thumbs_dir = 'thumbs/'; $thumbs_width = 150; $images_per_row = 5; /** generate photo gallery **/ $image_files = get_files($images_dir); if(count($image_files)) { sort($image_files); $index = 0; foreach($image_files as $index=>$file) { $index++; $thumbnail_image = $thumbs_dir.$file; if(!file_exists($thumbnail_image)) { $extension = get_file_extension($thumbnail_image); if($extension) { make_thumb($images_dir.$file,$thumbnail_image,$thumbs_width); } } $title = str_replace( ".jpg", "",$file); echo '<a href="',$images_dir.$file,'" class="photo-link " title="'.$title.'" rel="lightbox[custom]"><span><input type="checkbox" name="interest[]" value="'.$title.'"></span><img src="',$thumbnail_image,'" /></a>'; if($index % $images_per_row == 0) { echo '<div class="clear"></div>'; } } echo '<div class="clear"></div>'; } else { echo '<p>There are no images in this gallery.</p>'; } ?> </p> <label for="Name">First Name:</label> <input type="text" name="Name" id="Name" /> <label for="City">Last Name:</label> <input type="text" name="last" id="last" /> <br /> <label for="Email">Email:</label> <input type="text" name="Email" id="Email" /> <label for="Email">ShutterYou Order Date:</label> <input type="text" name="order" id="order" /> <input type="submit" name="submit" value="Submit" class="submit-button" /> </form>
  17. Hello Everybody, I am trying to output multiple values from check boxes on a page they are actually images. So i am using this code to generate the images on the page with the check box From what i have been reading i should be using interest[] to put them into an array... echo '<a href="',$images_dir.$file,'" class="photo-link " title="'.$title.'" rel="lightbox[custom]"><span><input type="checkbox" name="interest[]" value="'.$title.'"></span><img src="',$thumbnail_image,'" /></a>'; So on my processing file i am using this to pull the values from the form if( isset( $_POST['interest'] ) && is_array($_POST['interest']) ) { foreach( $_POST['interest'] as $value ) { //each $value is a selected value from the form } } Then i am using this to output the value into the email that it generates $Body .= "Pictures Selected: "; $Body .= $value; This only send 1 value in the email, i need it to send all of the boxes that i am checking... Thanks for any help anyone can give...
  18. I am having an issue echoing the content from a custom field that i have called 'techspecs' I have added it to the database and i can post text to the database but when i call it on the page it looks like this: <p> Testing this area</p> <p> Second Line!!!</p> <p> sd</p> <p> asd</p> <p> fasdfasdf</p> I am using the wysywyg editor that the product description uses if this matters Thanks for any help on why it is putting the paragraph tags on the page instead of using them to display the text
  19. I am posting this into the Newbie forum cause this seems nebieish to me... Ok i have a few files that make up a set of pages Topbar.php index.php info_birmingham.php ( i want the title to match the info page i have a few cities ) footer.php OK so obviously the <title> is in top bar and i am trying to display the city name in the title which would be gotten from the info_city page so in topbar i have... <title><?php echo ("$city"); ?> - <?php echo COMPANY; ?></title> and then in the info_city page i have at the top of the page <?php $city = "Birmingham"; ?> So i guess my question is why does the title not display the city name? SOMEONE please help i have been pulling my hair out on this you can see form the URL string that index.php controls all of the pages and the info page has the data for each city http://www.skbk.com/OaklandCounty/index.php?section=Birmingham Thanks to anyone that might be able to shed some insight on this for me T
  20. Hey there fellow PHP coders I am sorta a newbie with php but i am having a heck of a time with this If Else statement and i know someone with experience will be able to tell me why the else if is not working What this is here is on our company intranet our agent love to send out flyers without picture and makes us look bad... so this is an IF Else if there is a picture display the eFlyer options else dont display the flyer options If doesnt seem to do the else can anyone see something that i am not seeing i have been staring at it for 2 hours now trying different little things and havent been able to get it to work PLEASE PLEASE help me thanks for everyone who reads this <?php if( $mlsInfo['PhotoURL'] != "") echo "<a href='emailListing.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 0)' onMouseOut='hideTip()' ><img src='images/buttons/fb_eListing.gif' width='106' height='20' border='0'></a> <a href='emailPostcard.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 2)' onMouseOut='hideTip()' ><img src='images/buttons/fb_ePostcards.gif' width='106' height='20' border='0'></a> <a href='emailFlyer.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 3)' onMouseOut='hideTip()' ><img src='images/buttons/fb_Flyer.gif' width='110' height='20' border='0'></a> <a href='../print_rs.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 5)' onMouseOut='hideTip()' ><img src='images/buttons/fb_printFlyer.gif' width='106' height='20' border='0'></a> <a href='fb_propertyRS_print.php?type=rs&mlsn=".$propInfo['MLSNumber']."' target='_blank' onMouseOver='doTooltip(event, 4)' onMouseOut='hideTip()' ><img src='images/buttons/fb_printListing.gif' width='106' height='20' border='0'></a> "; else echo "You Dont have any photos please add some"; ?>
  21. Yeah i guess i cant disagree with you... though i know that my coding techniques might not always be the most efficient... but thank you for your more indepth help...
  22. Thanks hcdarkmage it is coming from checklist buttons but i have made it work though i dont know it is the best way to do it is this the best way to do it? if($buying != "" or $selling != "" or $first != "" ) { $Body .= "\r\n Interested in: ".$buying.$selling.$first; } i also was using the \r\n instead of the <br /> due to it not putting a return in the actual email it was just displaying <br /> Thanks for your continued support
  23. Thank You Both Alex and hcdarkmage... i didn't quite understanding what Alex was exactly saying in that case... thanks for elaborating hcdarkmage you were exactly correct if applied correctly it DOES indeed Work... I am very much a PHP noob maybe you can help me write another similar statement with applying that same code... ok so i am trying to do the same thing only display things that are filled in from the contact form... so currently i am using this to fill in there time frame of when they want to buy something $Body .= "Time Frame of buying: "; $Body .= $immediate; $Body .= $Ldays; $Body .= $Mdays; Where on the contact form each of those variables such as $immediate is value = "Right Now!" then i have added a comma and just so that it looks correct on the transmitted form any suggestions to make this all work together? and again thank you both you have been VERY helpful
  24. I defiantly appreciate the advice and the efficiency upgrade to the code butit doesnt get the results that i am looking for... i am trying to eliminate the extra space... and again i know this is stupid but it is what my boss is looking for
  25. OK guys thanks for reading my post! i am having a slight issue with a contact form and that is if someone doesnt fill in the phone number box then it just ads a blank space to the email that gets sent such as below: This is filled out - Name: Larry Boy Phone: 703-922-4010 Email: larry@skbk.com This is not filled out- Name: Larry Boy Email: larry@skbk.com I am using this to figure out if it is actually blank or not: if ($Tel == "") $TelResults = ""; else $TelResults = "Phone: ".$Tel; and this to display it on the email $Body .= $TelResults; I understand this is VERY small thing but my boss hates getting contacts forms that "dont look right" i have scowered the net trying to figure this out so now i am turning to this forum for some help... Can someone please point me in the right directions...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.