This is a discussion on need help with generating html source from the php within the PHP Language forums, part of the PHP Programming Forums category; Hi every body, I need your help in a problem am facing, I have two forms on my website which ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi every body,
I need your help in a problem am facing, I have two forms on my website which when submitted they goto single page (confirmation.php) and the two forms are for English and Arabic versions and what I want to do is to create a single confirmation page which is responsible to send the forms values. What I want to do is that when the arabic form is submitted the confirmation echos arabic succesful note and when english an english successful note is echoed which is easy to do but my problem is that the <head> section of the confirmation contains a redirection meta tag for the home page and I want the meta tag to be generated according to the language interface, and I dont know how to generate HTML using the php so please if anybody could help me this will be really appreciated. or even to direct me to a tutorial for this situation. Thanks for help in advance shror |
|
|||
|
Me thinks you need to read up a bit on php. Try http://w3schools.com/php/default.asp
$language = 'Arabic'; if ($language == 'Arabic'){ echo "<html><head><title>Some HTML and Arabic stuff</title></head>"; } elseif ($language == 'English'){ echo "<html><head><title>Some HTML and English stuff</title></head>"; } else { echo "You must choose a Language"; } Regards, Paul |
|
|||
|
shror wrote:
> Hi every body, > > I need your help in a problem am facing, > I have two forms on my website which when submitted they goto single > page (confirmation.php) and the two forms are for English and Arabic > versions and what I want to do is to create a single confirmation page > which is responsible to send the forms values. > What I want to do is that when the arabic form is submitted the > confirmation echos arabic succesful note and when english an english > successful note is echoed which is easy to do but my problem is that > the <head> section of the confirmation contains a redirection meta tag > for the home page and I want the meta tag to be generated according to > the language interface, and I dont know how to generate HTML using the > php so please if anybody could help me this will be really > appreciated. > or even to direct me to a tutorial for this situation. > > Thanks for help in advance > > shror > <?php echo "<b>This text is bold</b>\n"; ?> -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|||
|
On Sep 26, 10:30 pm, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> shror wrote: > > Hi every body, > > > I need your help in a problem am facing, > > I have two forms on my website which when submitted they goto single > > page (confirmation.php) and the two forms are for English and Arabic > > versions and what I want to do is to create a single confirmation page > > which is responsible to send the forms values. > > What I want to do is that when the arabic form is submitted the > > confirmation echos arabic succesful note and when english an english > > successful note is echoed which is easy to do but my problem is that > > the <head> section of the confirmation contains a redirection meta tag > > for the home page and I want the meta tag to be generated according to > > the language interface, and I dont know how to generate HTML using the > > php so please if anybody could help me this will be really > > appreciated. > > or even to direct me to a tutorial for this situation. > > > Thanks for help in advance > > > shror > > <?php > echo "<b>This text is bold</b>\n"; > ?> > > -- > ================== > Remove the "x" from my email address > Jerry Stuckle > JDS Computer Training Corp. > jstuck...@attglobal.net > ================== I read about php on w3schools but the problem is that what I understood is that the echo is used t echo something to the user to read so that if I used $language = 'Arabic'; if ($language == 'Arabic'){ echo "<html><head><title>Some HTML and Arabic stuff</title></head>"; } elseif ($language == 'English'){ echo "<html><head><title>Some HTML and English stuff</title></head>"; } else { echo "You must choose a Language"; } then I get on the page: <html><head><title>Some HTML and English stuff</title></head> anyway thanks for your help every body shror |
|
|||
|
On Sep 26, 10:21 pm, macca <ptmcna...@googlemail.com> wrote:
> Me thinks you need to read up a bit on php. Tryhttp://w3schools.com/php/default.asp > > $language = 'Arabic'; > > if ($language == 'Arabic'){ > > echo "<html><head><title>Some HTML and Arabic stuff</title></head>"; > > } elseif ($language == 'English'){ > > echo "<html><head><title>Some HTML and English stuff</title></head>"; > > } else { > > echo "You must choose a Language"; > > } > > Regards, > > Paul I tried your example Paul and It worked great I really feel as dumb but I have a small problem I don't know why it happened, I have created a page using notepad and saved it .php and Unicode, but when I tested it online it was not working so I Saved it as ANSI and tested it once more and the code worked correctly why is this happening Thanks for help in advance and the previous help too shror |
|
|||
|
"shror" <shahirwm@gmail.com> wrote in message
news:1190829223.398719.48620@22g2000hsm.googlegrou ps.com... > Hi every body, > > I need your help in a problem am facing, > I have two forms on my website which when submitted they goto single > page (confirmation.php) and the two forms are for English and Arabic > versions and what I want to do is to create a single confirmation page > which is responsible to send the forms values. > What I want to do is that when the arabic form is submitted the > confirmation echos arabic succesful note and when english an english > successful note is echoed which is easy to do but my problem is that > the <head> section of the confirmation contains a redirection meta tag > for the home page and I want the meta tag to be generated according to > the language interface, and I dont know how to generate HTML using the > php so please if anybody could help me this will be really > appreciated. > or even to direct me to a tutorial for this situation. That's difficult to impossible to say - without seeing the code. I think it boils down to one comment - "I don't know how to generate HTML". You could probably resolve your issue by finding the place in the code where the META tag is generated and then to use a conditional (if-the-else) to generate the appropriate line. |
|
|||
|
shror wrote:
> On Sep 26, 10:21 pm, macca <ptmcna...@googlemail.com> wrote: >> Me thinks you need to read up a bit on php. Tryhttp://w3schools.com/php/default.asp >> >> $language = 'Arabic'; >> >> if ($language == 'Arabic'){ >> >> echo "<html><head><title>Some HTML and Arabic stuff</title></head>"; >> >> } elseif ($language == 'English'){ >> >> echo "<html><head><title>Some HTML and English stuff</title></head>"; >> >> } else { >> >> echo "You must choose a Language"; >> >> } >> >> Regards, >> >> Paul > > I tried your example Paul and It worked great I really feel as dumb > but I have a small problem I don't know why it happened, I have > created a page using notepad and saved it .php and Unicode, but when I > tested it online it was not working so I Saved it as ANSI and tested > it once more and the code worked correctly why is this happening > > Thanks for help in advance and the previous help too > > shror > Maybe because PHP is an ANSI language? You don't need to save a file as unicode to send unicode to the browser. And, in fact, if you do, you'll get other problems. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|||
|
"Sanders Kaufman" <bucky@kaufman.net> wrote in message news:82NKi.37169$RX.8150@newssvr11.news.prodigy.ne t... > "shror" <shahirwm@gmail.com> wrote in message > news:1190829223.398719.48620@22g2000hsm.googlegrou ps.com... >> Hi every body, >> >> I need your help in a problem am facing, >> I have two forms on my website which when submitted they goto single >> page (confirmation.php) and the two forms are for English and Arabic >> versions and what I want to do is to create a single confirmation page >> which is responsible to send the forms values. > >> What I want to do is that when the arabic form is submitted the >> confirmation echos arabic succesful note and when english an english >> successful note is echoed which is easy to do but my problem is that >> the <head> section of the confirmation contains a redirection meta tag >> for the home page and I want the meta tag to be generated according to >> the language interface, and I dont know how to generate HTML using the >> php so please if anybody could help me this will be really >> appreciated. >> or even to direct me to a tutorial for this situation. > > That's difficult to impossible to say - without seeing the code. > I think it boils down to one comment - "I don't know how to generate > HTML". > > You could probably resolve your issue by finding the place in the code > where the META tag is generated and then to use a conditional > (if-the-else) to generate the appropriate line. An interesting question occurred to me. Using the if statement outlined previously in this thread, what happens with the echo when the desired language reads from right to left and not left to right? Is it simply that the entire string is captured in the quotes and so appears on the screen as right to left? If that is the case, then what happens with word wrap? Wouldn't it then break at the beginning of the sentence rather than in the middle? (I have only worked on English sites). Shelly |
|
|||
|
"Shelly" <sheldonlg.news@asap-consult.com> wrote in message
news:13fnapid7bhrdb9@corp.supernews.com... > "Sanders Kaufman" <bucky@kaufman.net> wrote in message >> You could probably resolve your issue by finding the place in the code >> where the META tag is generated and then to use a conditional >> (if-the-else) to generate the appropriate line. > > An interesting question occurred to me. Using the if statement outlined > previously in this thread, what happens with the echo when the desired > language reads from right to left and not left to right? I tend to buffer my echos until a block is fully composed. I think there's a bunch of "ob****" stuff in PHP for that, but I just use a variable. Thus, the answer to your question is to do it like this: Code:
if($sLanguage == "english"){
$sMessage = "Good God, almighty!";
} else {
$sMessage = "Allah akbar!";
}
echo $sMessage;
> Is it simply that the entire string is captured in the quotes and so > appears on the screen as right to left? If that is the case, then what > happens with word wrap? I don't understand the question. You had me up until word-wrap. When you echo a string, as shown - it spits the result out to std_out as composed. There's no word-wrap unless the client is doing something like that. Does that help answer the question? > Wouldn't it then break at the beginning of the sentence rather than in the > middle? (I have only worked on English sites). Huh? Not in any context I can think of. |