A simple PHP Question
Hey guys,.
I learn some basic PHP to make a simple form, and I have a small question. I have these two test of the PHP, Form.php and acion.php files. What you enter in the form is then displayed via $_POST to action.php that gets displayed. Here are the test sites:
http://christianstest.info/phptest/form.php
http://christianstest.info/phptest/action.php
And for two, verry simple code:
Form.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PHP Form Test</title> </head> <body> <form action="action.php" method="post"> <p>Your name: <input type="text" name="name" /></p> <p>Your age: <input type="text" name="age" /></p> <p><input type="submit" /></p> </form> </body> </html>
and action.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> Hi <?php echo htmlspecialchars($_POST['name']); ?>. You are <?php echo (int)$_POST['age']; ?> years old. </body> </html>
Now I want to do is have action.php store data entered in Form.php so that someone could link directly to action.php and see what the end user concluded Form.php. Now, if you go directly to a non action.php caching it does nothing for the return of name and age. How can I get this data stick? If in fact, it is not a simple question, can you point me to a tutorial? Thank you!
You'll want to republish this topic in the Dreamweaver forum:
http://forums.Adobe.com/community/Dreamweaver?view=discussions
Take care, Mike
Tags: Dreamweaver
Similar Questions
-
Hi all
This isn't a question of Dreamweaver, but a matter of php. Here is the code:
<? PHP echo $row ["emailAddress"]? >
I just want to create a link "mailto" for the database query "emailAddress".
Any help would be great.
ShaneThanks Murry as usual
Shane
-
Simple PHP arrays not displaying after filling... newb question
Hey guys,.
If I have this simple text file, menu2.txt, which looks like this:
1 Test pizza One Loaded with all that test pizza goodness! Lots and lots of ones 1111! 11.99 3 Test Threeza! Do you see what I did there? I added a three to pizza, hahaha, I am so punny. 33.33 2 Test Pizza Two The same as one with an extra one, yum! 22.99
and a little bit of simple php that needs to fill a few tables with this information that looks like this:
<?php $menu2=fopen("pizzaMenu2.txt","r") or exit("System Error! Unable to collect the test menu"); $title2=array(); $descreption2=array(); $price2=array(); $arraypos2=0; $tempstring2; //This loop does all of the READING and populating of variables while(!feof($menu2)) { //First get the array possition $arraypos2 = fgets($menu2); //Then Put in Title in title2 array //populate the temparary string $title2[$arraypos2] = fgets($menu2); //Then Put in Description in descreption2 array //populate the temparary string $descreotion2[$arraypos2] = fgets($menu2); //Finaly Put in Price in price2 array //populate the temparary string $price2[$arraypos2] = fgets($menu2); } //End of reading loop $arraypos2=1; while($arraypos2 <=3){ echo $title2[$arraypos2]; echo "<br />"; echo $descreotion2[$arraypos2]; echo "<br />"; echo $price2[$arraypos2]; echo "<br />"; $arraypos2++; } fclose($menu2); ?>
My problem is that the while loop bottem does not display anything but empty lines on my Web page (I.E. that line breaks work) and no text to their respective tables. However, if I coppy and past the same code from inside the low while loop at the bottem to top while loop then everything displays correctly. I understand something about how variables contain values in PHP, am I missing somehting? What's wrong with this code?
(P.S. I know that using a matrix (or array of arrays) is better than using two tables, but I am simply play to understand here).
Thank you guys. P.S. you can see the code does not not on my server of text here. It's at the top of the page. Thank you!
The only thing I can imagine there was a difference in the data type of the needle of the table. When filling you read in a file. As an integer is valid, it should be the case as such, but perhaps it is interpreted as a char type. You use a counter in your second loop. GetType() allows to see if it is is mixed up.
-
I want to be able to create an if/else statement for the formatting of a date cell in an array of dynamic results.
This cell turns red if the returned date is less than a specified number of days plus the date today.
The problem is, I don't know how to subtract days to a date format.
$OldDateThreshold = (date("Y-m-d")-365); Where I am defining a threshold year. -It just returns a value of 1642?
I don't hate this PHP, MySQL date format!
RichardODreamweaver wrote:
> For some reason any, if I get a date e.g. 01/02/2007, it highlights ALL
> records, even after this date.
>
> If I go on 01/02/2006, it will highlight all records not updated<>
>
> It does not take into account the MMDD.
>
> Does mean more?Yes, it makes more sense. Without doing a lot of testing, I'm
guessing that PHP will be treated on 01/02/2006 as a calculation and
produces the result 1003 (/ is the symbol of the division), or is it
treat both sides of your comparison as strings. In the latter case,.
even if the numbers are the same, MySQL returns the date with
Hyphens, not forward slashes, so you are not comparing like with like.What I tested is the fact that strotime() accepts the two 2006/02/01
2006-02-01 dated valid formats and to create a Unix timestamp. So that the
solution is the same that I gave you before:
? >... Another thing... etc.Computers can do a lot of calculations at lightning speed, but they are
simple creatures when it comes to logic. You must compare as with
as. You know it's a date. I know it's a date, but to a computer, it is
a bunch of numbers and symbols.--
Adobe Community Expert David Powers
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/ -
Most developers use the same password for the mySQL databases on their localhost and production servers? Any reason, too?
-Laxmidi
I think that most are not...
only fear is security; However, if your development computer is not shared by others, its ok to use the same server.
-
Table Simple Dreamweaver question
I have so many tables, 100 rows, 5 columns for my data. Here's my question, is there a way to tilt the table given above then go down and up and down. All my data is from the old to the new, when I want recent to old. I know that you can do in Excel by alphabet or date, id there a way DW
Someone can correct me if I'm wrong, but I'm sure you can't sort a column or row of values in a table html using DW. What you could do is create your list in Excel, sort the list in Excel and copy the range of the table and paste it into DW, which will create a perfect html table. You can also copy and paste from Dreamweaver to Excel, but it is not as simple. You will need to copy and paste a column at a time, and you will have an additional empty line for each line populated.
Another solution is to create a mySQL table that can be easily sorted and uses PHP to display the table on your page. You must know at least the basics mySQL and PHP to do that, but if want to add constantly new records to your table, mySQL is your best solution. If your table is static, the first solution works perfectly.
-
If exposed simple of questions?
Alright fellow programmers. Once more what I meet a problem I have EVER had with other JAVA programs before. IAM trying to figure out how to write a simple if statement and I have questions. I did Google search and have found something to help. So, if you could please tell me what may be the issue? The error message is "error {invalid AssignmentOperator. syntax". Thanks in advance!
Double BinRadius = (Integer.parseInt (txtRadiusFeet.getText ()) * 12) + Integer.parseInt (txtRadiusInches.getText ());
FieldChangeListener CalcListener = new FieldChangeListener() {}
' Public Sub fieldChanged (field field, int context) {}
Double BinRadius = (Integer.parseInt (txtRadiusFeet.getText ()) * 12) + Integer.parseInt (txtRadiusInches.getText ());{If(BinRadius==0)}
Dialog.Alert ("Hello");
}
};Capital I yew?
-
I write from SQL result to a CSV file. I need to add the URL field with an amazon key is a long string (no comma, no spaces between).
<? PHP
$con = mysqli_connect ("localhost", "username", "password") or die ('could not connect to mysql');
mysqli_select_db ($con, "database") or die ("no data found");
must add urtl with this key for all records
$amazon = "s3 |" AccessKeyID | SecretAccessKey | bucketName | » ;
$result = mysqli_query ($con, "SELECT * FROM MyTable WHERE url LIKE '% mp4% ' ORDER BY prodcode DESC");
$row = array ($result);
$fp = fopen ('myfile.csv', 'w');
While ($row = mysqli_fetch_array ($result, MYSQLI_NUM)) {}
fwrite ($fp, implode (', ', $row). « \r\n ») ;
}
fclose ($FP);
mysqli_close ($CON);
echo "< h2 > MyFile updated!" Good bye. < / h2 > ';
? >
Suggestions?
Nancy O.
If I understand your question, the following should do the job.
<>
$con = mysqli_connect ("localhost", "username", "password") or die ('could not connect to mysql');
mysqli_select_db ($con, "database") or die ("no data found");
must add urtl with this key for all records
$amazon = "s3 |" AccessKeyID | SecretAccessKey | bucketName | « ;
$result = mysqli_query ($con, "SELECT * FROM mytable WHERE url LIKE 'mp4% ' ORDER BY prodcode DESC");
$row = array ($result); Not sure that this is? Not necessary?
$fp = fopen ('myfile.csv', 'w');
While ($row = $result-> fetch_assoc()) {//Fetch data in an associative array, so we can refer to field by name
$row ['url'] is $amazon. $row ['url']; concatenate the value of the variable field and url amazon
fwrite ($fp, implode (', ', $row). « \r\n ») ;
}
fclose ($FP);
mysqli_close ($CON);
echo '
Put MyFile to date! Good bye.
';?>
-
An array of objects with a filling loop. Noob PHP question.
Hey guys,.
You are all such a great help! Here's another one for you, the simple code below should create an array of objects of pizza (and it does) then display each item in the order. However... each object in the table seems to inherit the properties of everything what was the last item entered for a reason any.
Copy the following code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <?php class pizza{ public $price; public $description; public $name; } $menu2=fopen("pizzaMenu2.txt","r") or exit("System Error!"); $pizzas = array(); $arraypos=0; //This loop does all of the READING and populating of variables while(!feof($menu2)) { //First get the array position $arraypos = (int)fgets($menu2); //Then Put in Title in title2 array $pizzas[$arraypos2] = new pizza(0,0,0); $pizzas[$arraypos2]->title = fgets($menu2); $pizzas[$arraypos2]->description = fgets($menu2); $pizzas[$arraypos2]->price = fgets($menu2); } //End of reading loop //begin writing data $arraypos=1; while ($arraypos <=3){ echo "the array is in position: ".$arraypos; echo "<br />"; echo $pizzas[$arraypos2]->title; echo "<br />"; echo $pizzas[$arraypos2]->description; echo "<br />"; echo $pizzas[$arraypos2]->price; echo "<br />"; $arraypos++; }//end of writing data loop fclose($menu2); ?> <body> </body> </html>
This returns:
the array is in position: 1 Test Pizza Two The same as one with an extra one, yum! 22.99 the array is in position: 2 Test Pizza Two The same as one with an extra one, yum! 22.99 the array is in position: 3 Test Pizza Two The same as one with an extra one, yum! 22.99
When it should return this:
the array is in position: 1 Test pizza One Loaded with all that test pizza goodness! Lots and lots of ones 1111! 11.99 the array is in position: 2 Test Pizza Two The same as one with an extra one, yum! 22.99 the array is in position: 3 Test Threeza! Do you see what I did there? I added a three to pizza, hahaha, I am so punny. 33.33
using the following text file pizzaMenu2.txt:
1 Test pizza One Loaded with all that test pizza goodness! Lots and lots of ones 1111! 11.99 3 Test Threeza! Do you see what I did there? I added a three to pizza, hahaha, I am so punny. 33.33 2 Test Pizza Two The same as one with an extra one, yum! 22.99
Now, I did line-by-line analysis and showed that the values are entered in the objects in the appropriate table, but everything that happens ultimately crushes all other objects, so ultimately, I have 3 objects in my table which are all the same. I don't know what I'm missing here.
$pizzas [$arraypos2]
must be:
$pizzas [$arraypos]
-
validation to a specific table only and simple a question on the dml trigger
Hi all
guess I am connected to a database with the user ' scott'/'tiger'@orcl and I have the fire instructions insert on 2 different tables allows say tables is
(1) emp
(2) Dept.
and now I want only to commit the emp table and not the table dept, is it possible to do?
Another question, I have... are commit simple dml triggers auto or not?
Concerning
RahulMac_Freak_Rahul wrote:
and now I want only to commit the emp table and not the table dept, is it possible to do?
No, it isn't. You post a transaction, not a table...
So if you have handled several tables in your transaction, you agree to be all these changes (via the command commit), or any of them (via restore).>
Another question, I have... are commit simple dml triggers auto or not?
If your dml trigger manipulate data (a very bad practice by the way), then they just add to all of the changes made to the breast of your transaction, you (as mentioned above), either commit all or none.
-
Hello world
My question is quite simple. I have two text boxes. I wrote "123" in the first text box and 'abc' in the second area. When I put the two boxes, the content in the second box automatically flowed to the first area, because there was space in the first box. Now the first box shows "123abc", and the second box is empty.
How to stop Indesign automatically cela. Is this possible? I know I can do it by screwing the two boxes first then the input data, but I have already entered all my data and it save me a lot of time if I can just have screw now. Thank you very much!
Simon
Until you put frames, insert a frame break in all Type > submenus insert a special character
Then content don't flow from 1 in frame 2 frame when you put on, because you insert a frame break stops at what happens.
-
Form created in DWCS4, PHP questions
Hello
I followed a line CS4 tutorial on how to create a form with validation.
If someone with experience in PHP can have a look for me, when you click on submit PHP code is displayed in the browser! rather than process information.
It's probably a simple error on my part, I looked at some more tut PHP books and online, but cannot see what is wrong.
http://www.epproductions.co.UK/charliepearcy/contactform.htm
Thank you very much
Mark
Hello
The reason why I asked is that it works well on my test server and as the display in plain text in a browser this normally indicates that the server recognizes as a file extension, but php not deal (not installed or disabled php) php code.
PZ
-
I have a PHP site that had a banner jpg image in the middle of the page. On the left side of the page, there is a vertical menu feeds cascade to the right with each submenu. Then the submenu waterfalls, is superimposed the jpg image in the cell of the table next to the menu. The question that I am trying to solve, is that when I replaced the image with a flash file jpg file and waterfalls of submenu to the right, browse through the menus are displayed behind the flash image. Is there a way to control this so that the submenus are visible? I have included the HTML used to display the flash image.
<!-- -------------------- -->
<! - flash banner - >
<!-- -------------------- -->
< object classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase ="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6, 0,0,0" width = "475" height = "575" id = "IM-Center-announcement" align = "middle" >
< param name = "allowScriptAccess" value = "sameDomain" / >
"" < param name = "movie" value = "... /Flash/GI-Center-AD.swf" / >
< param name = "quality" value = "high" / >
< param name = "bgcolor" value = "#ffffff" / >
"" "< embed src ="... /Flash/GI-Center-AD.swf "quality ="high"bgcolor ="#ffffff"width ="475"height ="575"name ="IM-Center-announcement"align ="middle"allowScriptAccess ="sameDomain"type =" application/x-shockwave-flash"pluginspage ="http://www.macromedia.com/go/getflashplayer"/ >"
< / object >
<!-end of Flash banner / /-->Thank you
RB
Try to insert a wmode parameter in both the object and embed tags abd see uf that helps...
For the project tag:
For the embed tag: wmode = "transparent".
-
darkening e-mail: php question
Hello
I have a question for beginners:
This link http://johnhaller.com/jh/useful_stuff/obfuscate_mailto/code/php/ shows how to link to contact obfuscation ' post to '. It gives the php code as well as what the code to use when calling the function.
Question: How do I display on my page.
I tried the following html code:
< span class = "email" > contact e-mail: <? = createMailto (' [email protected]')? > with the [email protected] is my correct e-mail address.
But all I see is the text "contact email".
The php code that I put in my directory root under /formtoemail/ObfuscateEmail.php
How can I get the function working properly?
Thank you!
Erik
Erik Arckens wrote:
No, I don't see "[email protected]" on my Web page.
In the source code that I wrote that the function call <> ' [email protected]')? >
I have nothing like the source code of your example in my code source. just this function call what I wrote here. In Dreamweaver design view, I see this PHP icon, but that's all.
And the php code, I put in a separate Directory in a file called OfuscateEmail.php
Do I did wrong?
- Does your server support PHP?
- Is the page that contains the=createMailto call="" named="" with="" a="" *.php=""?>
- This page contain an include of the OfuscateEmail.php script, or have that script embedded in the document (above the doctype)? (it is not just enough to save it in another file)
I suspect that the latter bullet is one that is the problem. You would need to insert it-
<>
function createMailto ($strEmail) {}
$strNewAddress = ";
for ($intCounter = 0; $intCounter)< strlen($stremail);="">
$strNewAddress. = « & # ». DSB (substr($strEmail,$intCounter,1)). ";";
}
$arrEmail = explode ("@", $strNewAddress);
$strTag = " ";
Return $strTag;
}
?>above the doctype on the page, and then save it with a php extension, for example, whatever.php.
The problem is that this then it's easy, it is also encouraging you to continue to use an unreliable method (the ' mailed to:' bind - ignore the space between "to" and "mail").
-
Really simple (hopefully) question about GPIB-USB-HS
I tried to reconnect a GPIB-USB-HS to a network through a PC HP on shelf Analyzer. Before removing the GPIB-USB-HS system about a week or two ago, Network Analyzer (a vintage 1989 HP 8720 vector Network Analyzer) had worked well with the GPIB unit. Now that I reconnected the GPIB device to network monitor, measurement and automation seems not be able to detect the Network Analyzer.
My question is: if my GPIB-USB-HS appear in measurement and automation, and it passes the NOR-488. 2 troubleshooting of HW and SW utility test, it would be safe for me to assume that whatever connection problems I have with the Analyzer network, rather than with the GPIB-USB-HS itself?
Thank you
Armando83
I finally got the connection working again. I just had to tighten the screws on the GPIB-USB-HS to make sure it's a good connection to the Network Analyzer so that it can work.
Thanks again for your help, Dennis.
Maybe you are looking for
-
UK site does not mention the availability of BT
Hello. I have no particular problem but a general question. I read specifications of most mobile phones on the United Kingdom and Polish Web sites (cause I live in Poland) and I discovered that the site Polish Toshiba always tells whether or not a la
-
HP PSC 1315 scanning painfully slow with HP 13.1 on Windows 7 Solution Center
I just upgraded to Windows 7 Premium 32 bit XP and installed the HP Solution Center 13.1 software. I created my preferences of scanning for documents at 200 dpi with shades of gray and when I scan a document, the scanner is extremely slow and it loo
-
HP Pavilion series p6000, mode: will not open a session
When you try to open a session after having start the computer. He says that the password is not valid. And it is typed correctly, we have tried several times. We tried to restore the computer, but it is not yet let us go beyond the login screen. Hel
-
Editing a document in Microsoft Mail link. Lost changes.
I opened a RTF file attached to an e-mail message. I made changes to the file and use CTRL-S to save the changes. I closed the document. When I opened it the document changes had disappeared.
-
Are updates for IE11, windows 7 stopped? Please let me know. I am very angry.