Jump to content

fareforce

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

fareforce's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I checed it out, and it works great! Thank you much! I guess I was trying to do it the hard way!
  2. Does extract() automatically set all of the variables to the html form input id? (ie. $first_name, $last_name, etc?
  3. I have never been good with looping, but I know there has to be a better way other than what I am doing. I have an html form that has a lot of fields, and is using the POST method, and sending it to my php file. In my php file I currently have $First_Name = $_POST[First_Name']; $Last_Name = $_POST[Last_Name']; $Address = $_POST['Address']; $City = $_POST['City']; $State = $_POST['State']; $Zip = $_POST['Zip']; $Phone = $_POST['Phone']; $Mobile = $_POST['Mobile']; $email = $_POST['email']; ....etc. and it works fine, but I am just trying to clean it up a little. What is a better way of doing this?
  4. I have a script that I am running into problems with. It is designed as a way to accept online employment applications. Everything is working, except when it gets submitted it emails the application layout, but doesn't include the variables. I have attached the files. Any suggestions would be appriciated! The main file is application.php Thanks! [attachment deleted by admin]
  5. Hmm.. That pulls all of the info, but still wont allow me to add html tags in it. I will look into the parse_ini_file function to see if I can get it to work though.
  6. I was playing around a bit, and came up with this: <?php include ('test2.php'); preg_match_all ("/prop_code[0-9] = (.*)/", $props, $val, PREG_SET_ORDER); foreach ($val as $propcode) { echo "Property Code: " . $propcode[1] . "<br /><br />"; } ?> And it is pulling the right info, but it is also only pulling the prop_code field. How can I get it to pull the rest of the information that goes with each prop_code? I also had to change test2.php to this format to get the above to work: <?php $props = " // This is the file that controls what properties display // Property images go in /images/properties/ // Keep each image in (ie. pic1a = 1a.jpg) // Property #1 prop_code1 = GN110 sqft1 = 1520 txt1 = Very nice property pic1a = pic1b = pic1c = pic1d = pic1e = pic1f = pic1g = // Property #2 prop_code2 = DBP-B sqft2 = 2165 txt2 = Nice Midtown Property pic2a = pic2b = pic2c = pic2d = pic2e = pic2f = pic2g = // Property #3 prop_code3 = ENLB246 sqft3 = 3250 txt3 = Nice Space pic3a = pic3b = pic3c = pic3d = pic3e = pic3f = pic3g = // Property #4 prop_code4 = 555-942 sqft4 = 1460 txt4 = Very nice property pic4a = pic4b = pic4c = pic4d = pic4e = pic4f = pic4g = " ?>
  7. I have two php files. I am trying to make a statement that will pull all of the information from test2.php into test one. test.php - main file test2.php - information file My thought was to turn test2.php into an array, and then pull it back into test.php using the foreach command. However, I can't get that to work. So it might not be the correct approch. Currently test.php contains: <?php include ('test2.php'); preg_match ('@^(?:prop_code)?([^/]+)@i', "test2.php", $propnum); foreach ($propnum as $V) { echo $V.'<br><br>'; } ?> I am not sure why but test.php always returns back whatever I have in the $subject section of the preg_match sytax. test2.php<br><br>test2.php<br><br> and test2.php contains: <?php // This is the file that controls what properties display // Property images go in /images/properties/ // Keep each image in "" (ie. $pic1a = "1a.jpg" // Property #1 $prop_code1 = "GN110"; $sqft1 = "1520"; $txt1 = "Very nice property"; $pic1a = ""; $pic1b = ""; $pic1c = ""; $pic1d = ""; $pic1e = ""; $pic1f = ""; $pic1g = ""; // Property #2 $prop_code2 = "DBP-B"; $sqft2 = "2165"; $txt2 = "Nice Midtown Property"; $pic2a = ""; $pic2b = ""; $pic2c = ""; $pic2d = ""; $pic2e = ""; $pic2f = ""; $pic2g = ""; // Property #3 $prop_code3 = "ENLB246"; $sqft3 = "3250"; $txt3 = "Nice Space"; $pic3a = ""; $pic3b = ""; $pic3c = ""; $pic3d = ""; $pic3e = ""; $pic3f = ""; $pic3g = ""; // Property #4 $prop_code4 = "555-942"; $sqft4 = "1460"; $txt4 = "Very nice property"; $pic4a = ""; $pic4b = ""; $pic4c = ""; $pic4d = ""; $pic4e = ""; $pic4f = ""; $pic4g = ""; ?> test2.php will always be in the same format (although I can change the format if needed). My end result needs to basically display the following for each $prop_code? (? = whatever the number is): $prop_code? <br /> $sqft? <br /> $txt? <br /> $pic?a <br /> $pic?b <br /> $pic?c <br /> $pic?d <br /> $pic?e <br /> $pic?f <br /> $pic?g <br /> Is an array the right way to do this, and is all of my formatting for test2.php correct.
  8. [code]Ok. So I am working on trying to get the above code to be a lot more simple. I basically need it to count how many properties need to be displayed (ie. prop_code1. prop_code2, etc.) I tried using this to figure it out, but it is far from working [code]<?php preg_match ('@^(?:prop_code)?([^/]+)@i', "propcontrol.php", $propnum); print_r($propnum); ?> It just returns back Array ( [0] => propcontrol.php [1] => propcontrol.php ) . So i need to figure out a way to count the properties, then get the information from propcontrol.php (which looks like this) // Property #1 $prop_code1 = "GN110"; $sqft1 = "1520"; $txt1 = "Very nice property"; // (ie. $pic1a = "images/properties/1a.jpg" $pic1a = "images/properties/1a.gif"; $pic1b = "images/properties/1b.gif"; $pic1c = "images/properties/1c.gif"; $pic1d = "images/properties/1d.jpg"; $pic1e = "images/properties/1e.jpg"; $pic1f = ""; $pic1g = ""; into this format, and automatically repeat for each property in propcontrol.php: <div class="row_top" style="padding-left:0;"> <div class="col_1 maxheight"> <div class="indent_left text text_lin"> <b> Property Code: GN110</b><br /> <table width="250" border="0"> <tr> <td width="114"> <a href=images/properties/1a.gif rel="lightbox["GN110"]"><img src="images/properties/1a.gif" height="100" /></a></td> <td width="10"></td> <td width="112"> <div align="left"> <a href=images/properties/1b.gif rel="lightbox["GN110"]"><img src="images/properties/1b.gif" width="32" height="32" /></a> <a href=images/properties/1c.gif rel="lightbox["GN110"]"><img src="images/properties/1c.gif" width="32" height="32" /></a> <a href=images/properties/1d.jpg rel="lightbox["GN110"]"><img src="images/properties/1d.jpg" width="32" height="32" /></a> <a href=images/properties/1e.jpg rel="lightbox["GN110"]"><img src="images/properties/1e.jpg" width="32" height="32" /></a> <a href="/images/nopic.gif" rel="lightbox["GN110"]"><img src="/images/nopic.gif" width="32" height="32" /></a> <a href="/images/nopic.gif" rel="lightbox["GN110"]"><img src="/images/nopic.gif" width="32" height="32" /></a> Here is what I am currently doing to display each property, and it works, but adding a new property takes awhile as this code only does one property: <div class="row_top" style="padding-left:0;"> <div class="col_1 maxheight"> <div class="indent_left text text_lin"> <b> Property Code: <?php print "$prop_code1"; ?></b><br /> <table width="250" border="0"> <tr> <td width="114"> <?php If ( $pic1a == "" ) { echo'<a href="/images/nopic.gif" rel="lightbox["' . $prop_code1 . '"]"><img src="/images/nopic.gif" height="100" /></a>'; } else { echo'<a href=' . $pic1a . ' rel="lightbox["' . $prop_code1 . '"]"><img src="' . $pic1a . '" height="100" /></a>'; }; echo'</td><td width="10"></td><td width="112"><div align="left">'; If ( $pic1b == "" ) { echo'<a href="/images/nopic.gif" rel="lightbox["' . $prop_code1 . '"]"><img src="/images/nopic.gif" width="32" height="32" /></a>'; } else { echo'<a href=' . $pic1b . ' rel="lightbox["' . $prop_code1 . '"]"><img src="' . $pic1b . '" width="32" height="32" /></a>'; }; If ( $pic1c == "" ) { echo'<a href="/images/nopic.gif" rel="lightbox["' . $prop_code1 . '"]"><img src="/images/nopic.gif" width="32" height="32" /></a>'; } else { echo'<a href=' . $pic1c . ' rel="lightbox["' . $prop_code1 . '"]"><img src="' . $pic1c . '" width="32" height="32" /></a>'; }; If ( $pic1d == "" ) { echo'<a href="/images/nopic.gif" rel="lightbox["' . $prop_code1 . '"]"><img src="/images/nopic.gif" width="32" height="32" /></a>'; } else { echo'<a href=' . $pic1d . ' rel="lightbox["' . $prop_code1 . '"]"><img src="' . $pic1d . '" width="32" height="32" /></a>'; }; If ( $pic1e == "" ) { echo'<a href="/images/nopic.gif" rel="lightbox["' . $prop_code1 . '"]"><img src="/images/nopic.gif" width="32" height="32" /></a>'; } else { echo'<a href=' . $pic1e . ' rel="lightbox["' . $prop_code1 . '"]"><img src="' . $pic1e . '" width="32" height="32" /></a>'; }; If ( $pic1f == "" ) { echo'<a href="/images/nopic.gif" rel="lightbox["' . $prop_code1 . '"]"><img src="/images/nopic.gif" width="32" height="32" /></a>'; } else { echo'<a href=' . $pic1f . ' rel="lightbox["' . $prop_code1 . '"]"><img src="' . $pic1f . '" width="32" height="32" /></a>'; }; If ( $pic1g == "" ) { echo'<a href="/images/nopic.gif" rel="lightbox["' . $prop_code1 . '"]"><img src="/images/nopic.gif" width="32" height="32" /></a>'; } else { echo'<a href=' . $pic1g . ' rel="lightbox["' . $prop_code1 . '"]"><img src="' . $pic1g . '" width="32" height="32" /></a>'; }; ?> Any pointers or help would be greatly appriciated! Am I even heading in the right direction?[/code][/code]
  9. Thank you! What about the looping statement part? How would I go about doing that?
  10. I will start off by saying that I am not very good at php, but I know enough to break things. lol Anyways on to my problem. I have two files properties.php, and propcontrol.php. Right now it is setup so when you view properties.php if pulls information from propcontrol.php to display pictures of different properties. To display the pictures I am currently using the following: <a href="<?php print "$pic1a"; ?>" rel="lightbox[<?php print "$prop_code1" ?>]"><img src="<?php print "$pic1a"; ?>" width="32" height="32" /></a> This is what propcontrol.php looks like: // Property #1 $prop_code1 = "GN110"; $sqft1 = "1520"; $txt1 = "Very nice property"; $pic1a = "/images/properties/1a.jpg"; $pic1b = "/images/properties/1b.jpg"; $pic1c = "/images/properties/1c.jpg"; $pic1d = "/images/properties/1d.jpg"; $pic1e = "/images/properties/1e.jpg"; $pic1f = "/images/properties/1f.jpg"; $pic1g = "/images/properties/1g.jpg"; The for the second property the format would be: ]// Property #2 $prop_code1 = "WBP210"; $sqft1 = "2150"; $txt1 = "Very nice property"; $pic2a = "/images/properties/2a.jpg"; $pic2b = "/images/properties/2b.jpg"; $pic2c = "/images/properties/2c.jpg"; $pic2d = "/images/properties/2d.jpg"; The problem with all of this is it makes the code very messy, and it is very time consuming to add new properties. I would like to make it so if $pic1a = ""; it will display /images/nopic.jpg, and it will automatically see how many properties there are total, and how many photos there are for each and display them. I have never done looping satements before, and I can't get this one to work. The closest I can get (although it doesn't loop) was: <?php If ( $pic1b = "" ) { echo'<a href="/images/nopic.gif" rel="lightbox['; print "$prop_code1"; echo']"><img src="/images/nopic.gif" width="32" height="32" /></a>'; } else { echo'<a href="'; print "$pic1b"; echo'" rel="lightbox['; print "$prop_code1"; echo']"><img src="'; print "$pic1b"; echo'" width="32" height="32" /></a>'; }; ?> But that doesn't work correctly as it outputs: <a href="" rel="lightbox[GN110]"><img src="" width="32" height="32" /></a> Please help!
  11. Ok. I tried using: [code]preg_match("|src = \"images/\" \+ Views\[View\] \+ \"(.*)\.png\"|Uis",get_put($url_aurora),$aurora);[/code] but it still isn't working. I guess I should also add the 3 (in the above example) is the variable I am pulling. It can range from 0-10.
  12. I am having problems with a preg_match. The bit of code I need to match up is: [code]document.images['picture'].src = "images/" + Views[View] + "3.png";[/code] The code I tried is, but it didn't work: [code]preg_match("|src = \"images/\" + Views[View] + \"(.*).png\"|Uis",get_put($url_aurora),$aurora);[/code] I am not very good with php code so I am sure I messed something up. Can anyone help me? Another line of code I could pull this from would be: [code]document.write ('3.png" border="0">');[/code] Any help would be greatly appriciated!  =)
×
×
  • 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.